ios - 收到错误:不推荐使用“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 一起使用'
解决方案
推荐阅读
- asp.net-mvc - 当我添加参数时,@Html.ActionLink 的 ASP.NET MVC 路由无法正常工作
- php - imap_body 工作不正确?
- spring - 启动 Spring Boot 应用程序的警告
- python - 基于系列的规则对 Pandas 数据框中的数据进行排序
- python - 嵌套循环和使用 iterrows 索引 pandas 数据帧
- python - Python utf8 编解码器无法解码位置 103 中的字节 0x80:无效的起始字节
- spring - 如何避免在 Spring jpa DATA 中创建依赖项目实体表?
- elasticsearch - 查询中的三个条件
- javascript - 在项目调试时出现此错误,错误是 req.next 不是函数
- node.js - 无法在 nodejs 中导入模块“处理程序”aws lambda 函数