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

时间:2021-02-02 10:13:48

标签: ios flutter 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 代替'

0 个答案:

没有答案