-1

プロジェクトの配置ターゲットを 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 は非推奨です。代わりに、preferredStyle の UIAlertControllerStyleAlert で UIAlertController を使用してください

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];

これらのエラーの助けをいただければ幸いです。

4

1 に答える 1

0

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];
于 2015-09-17T15:41:15.497 に答える