当前位置: 首页 > 知识库问答 >
问题:

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

章城
2023-03-14
    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个答案

卫宏硕
2023-03-14

您可以在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];
 类似资料:
  • 问题内容: 我收到此警告,但是该程序仍然可以正常运行。 MySQL代码向我显示了一条PHP消息: 不推荐使用:mysql_connect():不推荐使用mysql扩展,以后将被删除:在第2行的C:\ xampp \ htdocs \ task \ media \ new \ connect.inc.php中使用mysqli或PDO代替 我的页面是 这是什么意思,我该如何消除该消息? 问题答案: 有

  • 问题内容: 我正在尝试使用和进行单元测试。 当我不包含注释时,测试将失败。但 不推荐使用MockitoJUnitRunner类型 我正在使用Mockito 2.6.9。我应该怎么做? 问题答案: 现在确实已弃用,应该改为使用。如您所见,仅软件包名称已更改,该类的简单名称仍为 。 摘录自javadoc : 移至,该课程将在Mockito 3中删除

  • 新的侦听器(又名OnCameraMoveListener())方法onCameraMove()没有CameraPosition CameraPosition输入变量,所以我很迷惑:有没有方法回收我的旧代码? 这里有一些参考资料。

  • 我收到这个警告,但程序仍然正常运行。 MySQL代码用PHP向我显示了一条消息: 不推荐使用:mysql_connect():不推荐使用mysql扩展,以后将删除该扩展:在C:\xampp\htdocs\task\media\new\connect.inc.php第2行使用mysqli或PDO 我的页是 这意味着什么,我如何消除消息?

  • 问题内容: 我尝试学习Spring。我正在追踪这个网站http://www.roseindia.net/spring/spring3/spring-3-hello- world.shtml 我尝试了一个例子。我正在使用类似下面的内容,但是在这里显示: XmlBeanFactory类型已弃用 我必须用什么替代呢? 问题答案: ApplicationContext是BeanFactory的子接口。您可

  • 我正在使用bottomNavigationView,现在我想使用setOnNavigationItemReselectedListener,但它已被弃用。任何人都可以指导我应该使用什么。期待中的感谢