XPC connection interrupted in Xcode 7 for iOS 9
Asked Answered
A

11

65

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.

Alesha answered 20/9, 2015 at 20:48 Comment(6)
What version of OSX are you running?Incandesce
I'm running the latest version of YosemiteAlesha
I am seeing a similar issue when doing [self addChildViewController: child] I have been unable to find a fix or work around as of yet. I'm on Capitan, xCode 7, running on an iOS 9 simulator. If I drop the simulator to 8.4, this problem does not occur. Still hunting for solutions.Calfee
I am having the issue when I try to do a storyboard segue to a UINavigationController. It doesn't matter whether I use show, or present modally, animated or not animated. If I try to segue programmatically, still get the crash. I created a button in code, and tried a segue, still restarts the phone. I even made a different view controller, and it crashes every time I attempt a segue.Pompeii
See also this answer on a different question -- same error message, entirely different solution: https://mcmap.net/q/302739/-swift-xpc-connection-interrupted-and-app-freezesRegan
For my case, I totally uninstalled the app, then install it again rather than just override installing, the problem was goneLunarian
C
15

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.

Cusk answered 7/12, 2015 at 17:51 Comment(2)
Could you please help me in finding where that code can be located? I would like to delete it as well and see if that fixes the issue, perhaps then being able to confirm this the answer to my question.Alesha
Right clicking the storyboard file and view as source code. Don't search for <navigationItem> just look for <keyCommands> and comment it out or delete it. Just worked for me too thanks a lot.Gusman
R
6

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.

Russel answered 25/12, 2017 at 23:13 Comment(0)
M
4

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.

Muslin answered 30/10, 2015 at 21:37 Comment(0)
C
1

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.

Curculio answered 7/10, 2015 at 15:35 Comment(0)
L
1

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!

Loyalty answered 30/7, 2016 at 22:40 Comment(0)
T
0

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

Tibbs answered 24/11, 2015 at 12:27 Comment(0)
F
0

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
  }
Federalist answered 2/12, 2015 at 4:46 Comment(0)
D
0

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
  }
}
Dorty answered 27/1, 2016 at 11:26 Comment(0)
D
0

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

Dermott answered 5/10, 2019 at 15:47 Comment(0)
T
0

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

Tonguelash answered 18/4, 2020 at 22:21 Comment(0)
P
0

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

Pix answered 16/2, 2021 at 21:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.