*** 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导致的异常问题,并提供了解决方案,通过dispatch_once确保Present仅执行一次。

3035

被折叠的 条评论
为什么被折叠?



