Archive for Objective-c & iPhone

URLForUbiquityContainerIdentifier Unrecognized Selector

If you are trying to establish in your app if your user has iCloud enabled and your app keeps crashing with unrecognized selector error, then it is probably because you are trying to test on a device or simulator not running ios 5.

I use the following method which first checks if the method is available on the users device:


- (bool) isiCloudAvailable
{
    if(NSClassFromString(@"NSUbiquitousKeyValueStore")) { // is iOS 5?
        NSURL *ubiq = [[NSFileManager defaultManager] 
                       URLForUbiquityContainerIdentifier:nil];
        if (ubiq) {
            NSLog(@"iCloud access at %@", ubiq);
            return true;
        } else {
            NSLog(@"No iCloud access");
            return false;
        }
    }
    return false;
}

I then use:

if(self.isiCloudAvailable) {
     // code to sync iCloud information       
}

Hope this helps.

Use iTunes to make ringtones from your songs

I used this tutorial and it worked fine with an mp3 I had:

http://www.labnol.org/software/make-iphone-ringtons-with-free-itunes/4738/

New iPhone App

I have had another iPhone app released for the Press Association:

See it here on itunes