Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is that compatible to use iOS SDK 6.0 to develop application for iOS 5.1

I have just upgraded my XCode to 4.5 and installed the SDK 6.0. I have found that SDK 5.0 disappeared but I can still download back the Iphone 5.0 simulator.

I just wonder weather I can use SDK 6.0 to develop application for iOS 5.1. I have made the configuration shown in the following pictures.

enter image description hereenter image description here

like image 639
code4j Avatar asked Dec 20 '22 15:12

code4j


1 Answers

Yes any iOS SDK allows you to develop for previous versions of the OS as well. For example you can develop for iOS5 even with the iOS6 SDK.

You simply have to set the "Deployment Target" setting to 5.1.

You can then:

  • either only use methods available in iOS5.1 and don't use any iOS6-only methods to make sure your app will still run in iOS5.1
  • or perform a check at runtime each time you want to call a method that is only available in iOS6, and call this method only if it is available (if the user have its iPhone with a recent enough version of iOS that support this method).

For more information and detailed instruction for the configuration and example cases, I strongly suggest to read the SDK Compatibility Guide in Apple documentation.


For example, if you want to provide a button to share something on social networks, you could want to use the Social.framework, but this one is only available on iOS6. Thus you can propose this feature for iOS6 users and alert iOS5 users that they need to update their iPhone to iOS6 to use this specific feature:

// Always test the availability of a class/method/... to use
// instead of comparing the system version or whatever other method, see doc
if ([SLComposeViewController class])
{
    // Only true if the class exists, so the framework is available we can use the class
    SLComposeViewController* composer = [composeViewControllerForServiceType:SLServiceTypeFacebook];
    // ... then present the composer, etc and handle everything to manage this   
} else {
    UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Sharing unavailable"
                message:@"You need to upgrade to iOS6 to be able to use this feature!"
                delegate:nil
                cancelButtonTitle:nil
                otherButtonTitles:@"OK, will do!"];
    [alert show];
    [alert release];
}

Then simply weak-link the Social.framework (change "Required" to "Optional" when you add the framework to the linker build phases) as explained in details in the documentation.

like image 81
AliSoftware Avatar answered Dec 28 '22 06:12

AliSoftware