_BSMachError: (os/kern) invalid capability (20) _BSMachError: (os/kern) invalid name (15)错误的一种原因

来源:互联网 发布:地图poi数据是什么 编辑:程序博客网 时间:2024/05/29 04:53

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


0 0
原创粉丝点击