Ali*_*are 10
是的,任何iOS SDK都允许您为以前版本的操作系统进行开发.例如,即使使用iOS6 SDK,您也可以开发iOS5.
您只需将"部署目标"设置为5.1即可.
然后你可以:
有关配置和示例案例的更多信息和详细说明,我强烈建议您阅读Apple文档中的SDK兼容性指南.
例如,如果您想提供一个按钮来分享社交网络上的内容,您可能希望使用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];
}
Run Code Online (Sandbox Code Playgroud)
然后简单地弱链接Social.framework(当您将框架添加到链接器构建阶段时,将"Required"更改为"Optional"),如文档中详细说明的那样.
| 归档时间: |
|
| 查看次数: |
2101 次 |
| 最近记录: |