cocoa

Get IP address of arriving data package

Hi, So I'm creating an input socket using CFSocketCreateWithSocketSignature (NULL, &signature, kCFSocketDataCallBack, receiveData, &socket_context); Within the receiveData function (that gets called properly) I'm trying to use the CFDataRef address parameter to find out the sender address of the this "package". The IP address of the ...

how to get input from UIAlertView?

I want take player name as input by using UIAlertView. Is it possible to add textField on the UIAlertView? ...

UIWebView slow loading images--disturbs scrolling to anchors

We use encrypted web pages in our iPhone app, and intercepts these calls (e.g. when clicking a link) in the webView:shouldStartLoadWithRequest: method to get the file path, decrypt the data to the original html string and then doing a loadHTMLString: on the webView (returning YES in webView:shouldStartLoadWithRequest:, obviously). The p...

UIWebView redirect to facebook login page

UiWebView redirect its self to already login page.i want to stop redirect? I want web view to reload login page and ask for username and password.Clear context and load request again. NSString *urlAddress = [NSString stringWithFormat:@"http://www.facebook.com/login.php?]; //Create a URL object. NSURL *urld = [NSURL URLWithString...

Where can I get better Apple documentation?

More often than I'd have hoped I seem to come across method/property definitions in Apple's documentation that are vague at best and meaningless, to me, at worst. For example, take the following method description from NSNumberFormatter Class Reference: setPartialStringValidationEnabled: Sets whether partial string validation ...

Easy way to set a single character of an NSString to uppercase

I would like to change the first character of an NSString to uppercase. Unfortunately, - (NSString *)capitalizedString converts the first letter of every word to uppercase. Is there an easy way to convert just a single character to uppercase? I'm currently using: NSRange firstCharRange = NSMakeRange(0,1); NSString* firstCharacter = [da...

Auto-rotate the default application image according to current landscape mode

Hello! Is it possible to auto-rotate the default application image according to current landscape mode? I can rotate my views just fine according to information from the UIDevice class, but I would like the whole application to be in the correct landscape mode from the start. ...

Core data managed objects with extra ivars and methods...

Is it ok to add ivars and methods to an instance of NSMangaedObject? By "extra", I mean ivars that you don't want serialized. Do I just add them to my NSMangaedObject subclass like any other class or do I have to take any extra precautions? ...

How to get the Mac OS X system version?

I want to get the OS X system version, such as: 10.5.4, 10.4.8, etc. I want to get it in my app, how do I do this? Thanks! ...

sqllite3 prepare insert query in iphone programming

(BOOL) addticket { NSString *event=@"max"; NSString *venue=@"tvm"; sqlite3 *database; databaseName = @"smbhDB.sql"; sqlite3_stmt *addStatement ; NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDir = [documentPaths objectAtIndex:0]; ...

Are Core Data fetches (NSFetchRequest) sorted in any specific fashion by default?

Hello. I have a basic question. Say you have a NSFetchRequest which you want to perform on a NSManagedObjectContext. If the fetch request doesn't have any sort descriptors set to it explicitly, will the objects be random every time, or are they going to be spit out into an array in the order they were added to the Managed Object Context ...

Get text of button from IBAction - iPhone

When an IBAction is called: -(IBAction) onClick1: (id) sender; What is passed in the sender? Since it's hooked up through the IB, I'm not really sure. My question is how to get the text of the button to be the passed object (NSString most likely) so that I could call it inside the action implementation. -(IBAction) onClick1: (id) s...

What do I have to imagine when thinking about an "Library" in objective-c?

For me, a library is a collection of classes that do useful things. Typically something, that can be useful in a lot of projects. Is that also the case in terms of objective-c? What exactly is a library there? Only classes that have methods? Or also collections of functions? And do they have to be compiled to be called a "library"? Where...

Automatic updating of Xcode build phases for a target?

It seems that in a standard Xcode project, the default target automatically "updates" the Compile Sources build phase with any newly-added implementation files. This saves the user from having to drag each new file into the phase. I have defined a second target, which contains a large amount of unit testing code, which is linked as a di...

Registration for Cocoa shareware

What is the best way to protect a Cocoa shareware application from software piracy? Are there developer libraries/tools out there for this task? ...

User-friendly approach for network streaming, playing and seeking of audio files in Mac OS X 10.5

Please advise a combination of server and client technologies, tools and frameworks to implement a solution that meets the following requirements? File server in the network has a huge library of mp3/aac/aiff/wav music files Desktop cocoa application accesses audio files using URLs: rtmp, http, rtsp+rtp, ftp — how to make a choice? Audio...

NSString to wchar_t*?

I can't seem to find a good built-in way to convert an NSString to wchar_t... any tips on how to do this? Anything Apple exposes on the NSString class is for c-strings (char*) or for unichars, but nothing for wchar*. ...

cocoa: API to grab other application's window/document name

Is there an API in cocoa in which you can grab an application's window/document name? I've already got [[NSWorkspace sharedWorkspace] launchedApplication] to fetch all available applications, so I've got access to the bundle name or process id. What should I look into so that I can get other application's window/document name. ...

Override Interface Builder instantiation of objects?

I'm developing for the iPhone, and I have a class DataManager, that is used to maintain my application data. When the application launches/exits, the data is read from/written to disk to create an instance of this class, using the NSKeyedArchiver (and Unarchiver) classes, since the DataManager adheres to the NSCoding protocol. One probl...

Idiomatic, classy, open-source examples of Cocoa Interfaces?

Greetings, I'm currently learning Cocoa and Objective-C. I've run through "all" the tutorials and I'm fairly comfortable with the ObjC language. What I'm looking for now is to learn Cocoa idioms and see real code used in nice-looking Cocoa apps. It seems like serious apps (iTunes, etc.) don't just drop in the IB elements. They do a lot...