UIAlertController *alert=[UIAlertController alertControllerWithTitle:@"" message:@"修改" preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"设置" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
});
}]];
在使用UIAlertAction打开电话或者系统设置时候回报该警告,只需要将方法放入主线程中即可解决。
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
});