XPC connection interrupted in Xcode 7 for iOS 9

僤鯓⒐⒋嵵緔 提交于 2019-11-27 18:16:57

The problem lied in the storyboard for me as well. I created a new project and laid out the views and everything seemed to be working fine. I found these couple lines in the storyboard source (right click on storyboard and select view as -> source code) which weren't common between the working version and the broken version:

<keyCommands>
    <keyCommand/>
</keyCommands>

I have no idea what those lines are supposed to do, or how they crept into my storyboard file, but they were what was crashing the app so hard that the phone had to restart. I removed those lines from my main project and everything worked again.

This error can be caused by executing a loop repeatedly. In my case it was a 'for' loop in which I reset the counting variable. As soon as I added an NSLog in the loop it was obvious.

I just faced the same problem. I don't know if that will help you, but I also think it's coming from the Storyboard:

In my case, the problem is coming from a UITextView. Whenever I try to change the default text inside it, I have this error. If I let the default text or leave it empty, the app works fine. Making an IBOutlet and changing the text programmatically works as well.

I tried with other UI elements, but only the UITextView seems to have this issue.

I have struggled with exact same error. Through a process of elimination I established that it had nothing to do with the any class but had to do with the storyboard. Luckily I keep regular backup copies and I tried to compare storyboards to establish what I had done - but could find nothing obvious. The backup copy worked fine and I was able to copy my controller classes (from the faulty copy with the changes) into the backup copy and they worked fine.

I think there is a bug possibly in storyboards.

Deleting UITextView from the one of the view in Storybord removes the error in my case.

When using QLPreviewController, I am confronted with this problem. Error messages as follows,

XPC connection interrupted
_BSMachError: (os/kern) invalid capability (20)
_BSMachError: (os/kern) invalid name (15)

Since XPC means OS X interprocess communication, so I think this can solve the problem,

dispatch_async(dispatch_get_main_queue(), ^{
    // do what you want to do.
});

In valueChanged: method of a UIControl, I had the same problem so I made the code inside valueChanged: to run in main thread and it solved the problem.

@IBAction func valueChanged(sender: AnyObject) {
  dispatch_async(dispatch_get_main_queue(), {
  //code
  }
}

I have same error message when I place a subview in -layoutSubviews method:

-(void)layoutSubviews
{
    [super layoutSubviews];   
    [self populateByImageViews];
}

It causes infinite cycle of layout process and crashes app. Don't place subviews in this place!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!