iOS present AlertController时崩溃。 'Application tried to present modally an active controller .'

*** 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>.'

上一篇:IOS 如何获取app更新链接 如【itms-apps://itunes.apple.com/cn/app/id1362432761?mt=8】


下一篇:Jmeter代理录制获取登录参数_移动端设置代理