XPC connection interrupted in Xcode 7 for iOS 9

IphoneIos9Xcode7Xpc

Iphone Problem Overview


I recently updated to Xcode 7 and upgraded my iPhone to iOS 9. I have developed and released an iOS app that had worked perfectly fine on the latest version of iOS 8 and Xcode 6.

Upon trying to go through the process of updated the app for iOS 9 support, I am getting the most ridiculously strange error that has left me baffled.

I have done all the syntax corrections automatically through Xcode, and now my app builds properly. It even runs fine at first.

I have a button that segues to a view controller with a WebView. This view controller loads a link that will display either an image, website, or video from youtube. The content is loaded perfectly fine as always. However, the program will crash and reboot the simulator (and my iPhone) and send me to the lock screen when I click the Back button (I am on a navigation stack).

In Xcode, I get the following messages:

XPC Connection Interrupted. Terminating since there is no system app.

I have Flurry analytics integrated in my app by the way, not sure if thats an issue.

How can I fix this issue? My searches for XPC connections do not seem to return problems similar to mine. I do not even have a clue what an XPC connection is, so why is this in my app anyway?

EDIT: I have found a workaround for the issue. I cannot really say it is a fix.

The crashing was occurring during the use of the method self.navigationController?.popViewControllerAnimated, when set to true. I happened to set this to false, and the crashing stops (now the transition looks awful).

I do not know why this works, and just adds to my confusion.

Iphone Solutions


Solution 1 - Iphone

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.

Solution 2 - Iphone

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.

Solution 3 - Iphone

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.

Solution 4 - Iphone

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.

Solution 5 - Iphone

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!

Solution 6 - Iphone

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

Solution 7 - Iphone

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, especial when updating the UI

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

For Swift 4+, user

 DispatchQueue.main.async {
      //Your Code
  }

Solution 8 - Iphone

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
  }
}

Solution 9 - Iphone

For me was some missing constraints with a UISearchBar, but the error was only in the simulator.

I only add some constraints and works better

Solution 10 - Iphone

> For me it was xcode live issues caused by IB_DESIGNABLE

If you have any IB_DESIGNABLE in source files, the system's live tracker will check for issues in StoryBoard too. It may leads to unnecessary building.

To disable it-

Open Storyboard file. Editor -> Automatically Refresh Views (Uncheck)

If you needs to Disable Live issue tracking

XCode -> Preferences -> General -> Issues -> Uncheck Live Issues

Reference

Solution 11 - Iphone

My issue probably originated with some storyboard issue, but I cleaned the project, restarted Xcode AND restarted the simulator app and that fixed it.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestioniOShepherdView Question on Stackoverflow
Solution 1 - IphoneChase RobertsView Answer on Stackoverflow
Solution 2 - IphonePeter B. KramerView Answer on Stackoverflow
Solution 3 - IphoneRemy CiliaView Answer on Stackoverflow
Solution 4 - IphoneJeremy AndrewsView Answer on Stackoverflow
Solution 5 - IphoneSound BlasterView Answer on Stackoverflow
Solution 6 - IphoneMadhuriView Answer on Stackoverflow
Solution 7 - IphoneDawnSongView Answer on Stackoverflow
Solution 8 - IphoneGaurav SharmaView Answer on Stackoverflow
Solution 9 - IphoneHugo FortisView Answer on Stackoverflow
Solution 10 - IphoneSiempayView Answer on Stackoverflow
Solution 11 - IphoneAlexView Answer on Stackoverflow