当我将项目部署目标从iOS 8.4更改为iOS 9.0时,我会收到大量错误消息
当我将项目部署目标从iOS 8.4更改为iOS 9.0时,我会收到许多错误消息,例如: initWithRequest:delegate:startImmediately:'已弃用:在iOS 9.0中首次弃用-使用NSURLSession(请参阅NSURLSession.h) “UIAlertView”已弃用:iOS 9.0中第一个弃用-UIAlertView已弃用。改用UIAlertController的首选样式UIAlertControllerStyleAlert “init”已弃用:在iOS 9.0中首次弃用-请改用-initWithConcurrencyType: initWithRequest:delegate:'已弃用:在iOS 9.0中首次弃用-使用NSURLSession(请参阅NSURLSession.h)当我将项目部署目标从iOS 8.4更改为iOS 9.0时,我会收到大量错误消息,ios,objective-c,ios9,deprecation-warning,Ios,Objective C,Ios9,Deprecation Warning,当我将项目部署目标从iOS 8.4更改为iOS 9.0时,我会收到许多错误消息,例如: initWithRequest:delegate:startImmediately:'已弃用:在iOS 9.0中首次弃用-使用NSURLSession(请参阅NSURLSession.h) “UIAlertView”已弃用:iOS 9.0中第一个弃用-UIAlertView已弃用。改用UIAlertController的首选样式UIAlertControllerStyleAlert “init”已弃用:在iO
如果您对这些错误有任何帮助,我们将不胜感激 在iOS 9中,您使用的不是
UIAlertView
而是UIAlertViewController
:
UIAlertController *alertView= [UIAlertController
alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert];
[alertView addAction: [UIAlertAction actionWithTitle:otherButtonTitle
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
}]];
[self presentViewController:alertView animated:YES completion:nil];
这些不是错误消息,而是警告。您需要查看iOS9的文档,它将明确地告诉您不推荐使用的方法和类的替代方案。您现在无需执行任何操作,但在一段时间内,这些不推荐的项目将从SDK中删除,因此您最终需要将它们迁移到其备选方案。当您将部署目标设置为iOS 9时,这意味着您的应用程序将只支持iOS 9及以上版本,而不支持iOS 9以下版本。保持原样,在iOS 9设备上测试应用程序的兼容性问题。要添加@Rog声明的内容,请查找部署目标和基本SDK之间的差异。另外,请阅读iOS文档中的“SDK兼容性指南”。是。大多数人需要几个月才能升级到iOS 9。但总会有一些不升级或无法升级的,所以支持iOS 8的工作应该至少持续一年,如果不是更长的话(取决于你的应用程序和你的受众)。是的,这是正确的。
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:nil delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil, nil];
_managedObjectContext = [[NSManagedObjectContext alloc] init];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
UIAlertController *alertView= [UIAlertController
alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert];
[alertView addAction: [UIAlertAction actionWithTitle:otherButtonTitle
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
}]];
[self presentViewController:alertView animated:YES completion:nil];