提问者:小点点

不推荐使用“UIAlertView”:在iOS 9.0中首次不推荐使用


    else {
        [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil)
                                    message:NSLocalizedString(@"Camera not available.", nil)
                                   delegate:nil
                          cancelButtonTitle:NSLocalizedString(@"OK", nil)
                          otherButtonTitles:nil] show];
        self.result(nil);
        self.result = nil;
        _arguments = nil;
      }

}

我收到此错误,并且尝试将“UIAlertView”更改为“UIAlertController”仍然收到不同的错误。


共1个答案

匿名用户

您可以在xCode生成中使用以下UIAlertController替换:

UIAlertController *alert = [UIAlertController 
alertControllerWithTitle:@"Error" message:@"Camera not available" 
preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction *ok = [UIAlertAction actionWithTitle:@"Ok" style: style:UIAlertActionStyleDefault handler:nil];


[alert addAction:ok];
[self presentViewController:alert animated:YES completion:nil];