首页 > 移动平台 > 详细

iOS present AlertController时崩溃。 'Application tried to present modally an active controller <HKConnectViewController: 0x1050158e0>.'

时间:2019-08-19 12:06:38      阅读:91      评论:0      收藏:0      [点我收藏+]

*** Terminating app due to uncaught exception ‘NSInvalidArgumentException‘, reason: ‘Application tried to present modally an active controller <HKConnectViewController: 0x1050158e0>.‘

 

分析:

很有可能是你的触发事件中,触发了多次。也就是说:需要不止一次present。

解决办法:

加入单例,保证只执行一次

    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        [self presentViewController:self.bluetoothCloseAlertC animated:YES completion:nil];
    });

  

iOS present AlertController时崩溃。 'Application tried to present modally an active controller <HKConnectViewController: 0x1050158e0>.'

原文:https://www.cnblogs.com/liuhuakun/p/11375511.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!