微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

收到错误消息:不推荐使用“UIAlertView”:在 iOS 9.0 中首次不推荐使用 - 不推荐使用 UIAlertView

如何解决收到错误消息:不推荐使用“UIAlertView”:在 iOS 9.0 中首次不推荐使用 - 不推荐使用 UIAlertView

我正在使用 Flutter 开发移动应用。我在 Android 中实现了该应用程序,但我坚持使用 iOS。我收到此错误消息,我不知道如何解决

错误插件 Geolocator 一起出现。

- (void)showCamera {
  @synchronized(self) {
    if (_imagePickerController.beingPresented) {
      return;
    }
  }
  // Camera is not available on simulators
  if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] &&
      [UIImagePickerController isCameraDeviceAvailable:_device]) {
    _imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
    _imagePickerController.cameraDevice = _device;
    [[self viewControllerWithWindow:nil] presentViewController:_imagePickerController
                                                      animated:YES
                                                    completion:nil];
  } 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' 已弃用:首先在 iOS 9.0 中弃用 - UIAlertView 已弃用。使用 UIAlertController 和首选样式 UIAlertControllerStyleAlert 代替'

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。