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];
    });

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM