iphone – 兼容使用iOS SDK 6.0开发iOS 5.1应用程序
我刚刚将我的XCode升级到4.5并安装了SDK 6.0.
我发现SDK 5.0消失但我仍然可以下载回 Iphone 5.0模拟器. 我只是想知道天气我可以使用SDK 6.0开发iOS 5.1应用程序. 解决方法
是的,任何iOS SDK都允许您为以前版本的操作系统进行开发.
例如,即使使用iOS6 SDK,您也可以开发iOS5. 您只需将“部署目标”设置为5.1即可. 然后你可以: >要么只使用iOS5.1中提供的方法,要么不使用任何仅支持iOS6的方法来确保您的应用仍然可以在iOS5.1中运行 有关配置和示例案例的更多信息和详细说明,我强烈建议您阅读Apple文档中的SDK Compatibility Guide. 例如,如果您想提供一个按钮来分享社交网络上的内容,您可能希望使用Social.framework,但这个只能在iOS6上使用.因此,您可以为iOS6用户提出此功能,并提醒iOS5用户他们需要将iPhone更新到iOS6以使用此特定功能: // 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]; } 然后简单地弱链接Social.framework(当您将框架添加到链接器构建阶段时,将“Required”更改为“Optional”),如文档中详细说明的那样. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |