当我将项目部署目标从 iOS 8.4 更改为 iOS 9.0 时,我收到很多错误消息,例如:
'initWithRequest:delegate:startImmediately:' 已弃用:首先在 iOS 9.0 中弃用 - 使用 NSURLSession(参见 NSURLSession.h)
- (void)operationDidStart {
[self.lock lock];
if (![self isCancelled]) {
self.connection = [[NSURLConnection alloc] initWithRequest:self.request delegate:self startImmediately:NO];
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
for (NSString *runLoopMode in self.runLoopModes) {
[self.connection scheduleInRunLoop:runLoop forMode:runLoopMode];
[self.outputStream scheduleInRunLoop:runLoop forMode:runLoopMode];
}
[self.outputStream open];
[self.connection start];
}
[self.lock unlock];
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidStartNotification object:self];
});
}
'UIAlertView' 已弃用:首先在 iOS 9.0 中弃用 - UIAlertView 已弃用。改用 UIAlertController 和 UIAlertControllerStyleAlert 的preferredStyle
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:nil delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil, nil];
'init' 已弃用:首先在 iOS 9.0 中弃用 - 使用 -initWithConcurrencyType: 代替
_managedObjectContext = [[NSManagedObjectContext alloc] init];
'initWithRequest:delegate:' 已弃用:首先在 iOS 9.0 中弃用 - 使用 NSURLSession(参见 NSURLSession.h)
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
任何这些错误的帮助将不胜感激。