objective-c

I don't know how to use typedef enum.

typedef enum { kA = 0, kB, kC, kD, kE, kF } index; @interface myViewController : UITableViewController<UIAlertViewDelegate> { index enumIndex; } Hi, guys. I declare index which is composed by typedef enum. But I didn't found code like that. and If that code useful, does not need to release ? I don't und...

How to make a UITextView not take the focus when initializing?

I'm using code to create a detailed view pushed when you press a row of an UITableView, but theres a problem. The detailed view contain an UITextView and when a detailedView is called (only first time) this make the UITableView row pressed to lose its pressed state. It shouldn't ! It should lose the pressed state only when returning fro...

iPhone custom urls and encryption

Hello stackoverflow, Quick question: Are the custom URL's passed between applications encrypted in iOS? I can't seem to find any documentation anywhere that can tell me yes or no. Thanks! ...

id type to NSString

is there any way by which I can change an id type to NSString object? note the following line of my code. NSString *value = [appDelegate.bird_arr objectAtIndex:rowClicked] ; in this appDelegate is object of my AppDelegate class in a navigation based program and bird_arr is object of NSMutableArray. I want to use the string written in ...

Can't Find Framework .h File

I downloaded Andy Potion's "PFLetsMove" framework here and added the Xcode Project to my application's project. I then dragged the framework from that to the Link Binary with Libraries and Copy Files build phases. Now, if I compile the application with a call to PFMoveToApplicationsFolderIfNecessary() it works fine, so the framework is...

Why do people always use reassignment for instance variables in objective-C (namely iphone)?

I always see example code where in the viewDidLoad method, instead of saying, for example someInstanceVar = [[Classname alloc] init]; they always go Classname *tempVar = [[Classname alloc] init]; someInstanceVar = tempVar; [tempVar release]; Why is this? Isn't it the exact same thing, just longer? ...

Changing text of done button in keyboard

I know there is a question about this subject already but I think it's possible to change the text of the done button of a keyboard, because many of the apps I use are in french and the text of the done button is "accéder". But I don't know how to do this? ...

Best way to periodically drain the autorelease pool on a long-running background thread?

In the developer documentation, it says: If your application or thread is long-lived and potentially generates a lot of autoreleased objects, you should periodically drain and create autorelease pools (like the Application Kit does on the main thread); otherwise, autoreleased objects accumulate and your memory footprint grows. If, howe...

Replace string within a array

NSArray *ArtistNames = [RawData componentsMatchedByRegex:regEx1]; NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"&#39;"]; ArtistNames = [[ArtistNames componentsSeparatedByCharactersInSet: doNotWant] componentsJoinedByString: @"'"]; Thats my code at the moment basically i cannot use it as A...

iPhone/iPad - switching Views cause orientation problems

I'm working on a universal iPhone/iPad application. I'm using MonoTouch, but I can take answers in Obj-C (I should be able to decipher it, and MonoTouch's UIKit is 1 to 1 for the most part). Basically my app has 2 views: a "login" view and a "logged-in" view. On app startup, my login view is the only subview of my main UIWindow. Afte...

NSPredicate for to-many relationship, where a relationship (NSSet) must contain Entities defined in an NSArray

Given the following Core Data Model: -> : to-one releationship ->>: to-many relationship Entity A ->> Entity B Entity B -> A // each B belongs to exactly one A Entity B ->> B // a B can be related to other B's So in class A: @property (nonatomic, retain) NSSet *Bs; In class B: @property (nonatomic, retain) A *A; @propert...

Assertion Failed in Objective C

I'm getting the error "Assertion failed: (cls), function getName, file /SourceCache/objc4_Sim/objc4-427.1.1/runtime/objc-runtime-new.m, line 3939." whenever I run the following code. NSLog(@"Hello: %@\n", [NSMutableString stringWithString:@"Whatever"]); It also get about a thousand of the above error whenever I run this: NSMutabl...

What's the difference between @class Foo and import "Foo.h"?

What's the difference when using these codes: #import <UIKit/UIKit.h> #import "Foo.h" @interface EditFooViewController : UIViewController { Foo *foo; } @end and #import <UIKit/UIKit.h> @class Foo; @interface EditFooViewController : UIViewController { Foo *foo; } @end ...

iPhone UIImagePickerController file name

Hi, after getting a selected image in didFinishPickingImage, is there a way to get the filename or name of that image? Is there any string that uniquely identifies that image or that is saved with the image at the moment image was added to the photo album? Thanks. ...

declaring integer array in objective c without NSArray.n

(Question updated after first comment) int max_size = 20; int h[max_size]; Debugging gives a value of [-1] for h when using max_size to initialize; If instead I initialize using an integer. So the code is:int h[20] , it works fine. This was with GCC 4.2 on Mac OS X 10.6. ...

Download file without NSUrl/CFNetwork

Hello, I would like to download a file without using NSURL/NSURLDownload/CFNetwork. I would like to use something else because I am having issues with people using snow leopard. I have had problems in the past (un-fixable leaks, crashes). Is there a different way to solve this problem? ...

How to get the language used by an iPhone app.

How can I get which language an app is running on? And I don't mean the preference set into settings! Let me explain it further... I localised my app with three languages: English, Italian and Spanish. If the iPhone is set on Italian or Spanish, the app will use those two... it falls back to English otherwise. For example: a French use...

FoundationKit on gcc/Linux

I am trying to test Objective-C on Linux (Ubuntu 10.04), mainly to decide if it's worth it to get a Mac and XCode. I have to like a language before I seriously consider programming in it (even more so when I have to pay a lot for it) I am using gcc (with gobjc++). But this of course does not include the Foundation Kit and the rest of th...

IPhone App Build Successful But nothing shows

Hi Very new to Iphone development here, I have a project which is successfully building (which is a first for me :) It loads the simulator but it just closes as soon as it loads, how can I debug this? It appears the Interface Builder xib files are not loading, I've added a xib thats from a hello world project, (they have different proj...

Change Default Browser Programmatically Mac OSX

How would you change the default browser programmatically on Mac OSX. For example from safari to chrome, or chrome to firefox? Thanks ...