码迷,mamicode.com
首页 > 系统相关 > 详细

_BSMachError: (os/kern) invalid capability (20) _BSMachError: (os/kern) invalid name (15) 问题的解决

时间:2016-07-06 18:02:11      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:

  在项目中突然遇到一个问题,也就是_BSMachError: (os/kern) invalid capability (20) _BSMachError: (os/kern) invalid name (15) 

  虽然该问题对界面展示以及数据保存都没有影响,但是处于本人对于提示错误的洁癖,对于该问题进行了调研.

  错误出现的情景:

- (void)showAlterView {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"是否确定放弃本次编辑" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *_Nonnull action) {
}];

UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[self.navigationController popViewControllerAnimated:YES];
}];
[alertController addAction:cancelAction];
[alertController addAction:otherAction];
[self presentViewController:alertController animated:YES completion:nil];
}


点击确定后返回上一个控制器时会出现这个错误

 

 

  解决办法:

- (void)showAlterView {

    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"是否确定放弃本次编辑" preferredStyle:UIAlertControllerStyleAlert];

    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *_Nonnull action) {

                                   }];

 

    UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {

                                      dispatch_async(dispatch_get_main_queue(), ^{

 

            self.introduceTextView.delegate = nil;

            [[NSNotificationCenter defaultCenter] removeObserver:self.introduceTextView];

            [self.navigationController popViewControllerAnimated:YES];

        });

                                  }];

    [alertController addAction:cancelAction];

    [alertController addAction:otherAction];

    [self presentViewController:alertController animated:YES completion:nil];

}

 

即将alterAction事件放到主线程中去执行.

 

ps:本人由于精力和时间有限,并没有对该问题进行深入研究,希望同行大神有什么理解还有深入研究,可以告知小女,小女在此谢过各位大牛.

_BSMachError: (os/kern) invalid capability (20) _BSMachError: (os/kern) invalid name (15) 问题的解决

标签:

原文地址:http://www.cnblogs.com/HMJ-29/p/5647363.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!