7

UPDATE: I've used one of my DTS for the year on this. Currently working with an Apple Support Engineer. On his suggestion, I've also created a bug report for this. I'll update this thread as time passes hopefully resulting in a FINAL solution.

Somehow, I've figured out a way to create an app that literally reboots a simulator and/or physical device. Hurray for me. This problem started when I upgraded to xcode 7 and started testing against iOS 9. On ANY device/simulator < iOS 9, this problem does not rear its ugly head.

When I run it attached to Xcode, the only log messages I see are

XPC connection interrupted
Terminating since there is no system app.

I have narrowed it down to a section of code that is calling

[self addChildViewController:segue.destinationViewController];

This code is a part of a "MultichildContainerViewController" created in the style of this view controller

At this point, I just don't know where to look/do to fix this problem. If I comment out the addition of the childviewcontroller, everything is fine and the app runs normally. If I do NOT comment it out, it reboots my entire simulator.

Any ideas on where to find additional debug information or potential fixes? I just don't know where to look at this point to find more information to in turn use to ask for help. Any help is appreciated, thanks.

EDIT: I don't know if this helps, but I was able to hunt this down in the actual iOS Simulator system.log. Doesn't seem to have any references to my own codebase, just backboard?

Oct 16 17:56:29 MyComputer backboardd[43977]: -[NSNull isEqualToString:]: unrecognized selector sent to instance 0x10de1baf0
Oct 16 17:56:29 MyComputer backboardd[43977]: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull isEqualToString:]: unrecognized selector sent to instance 0x10d
e1baf0'
*** First throw call stack:
(
0   CoreFoundation                      0x000000010dbf6f65 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x000000010df82deb objc_exception_throw + 48
2   CoreFoundation                      0x000000010dbff58d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3   CoreFoundation                      0x000000010db4cf7a ___forwarding___ + 970
4   CoreFoundation                      0x000000010db4cb28 _CF_forwarding_prep_0 + 120
5   BackBoardServices                   0x000000010d020b28 -[BKSHIDEventKeyCommandDescriptor isEqual:] + 155
6   CoreFoundation                      0x000000010db1630b -[__NSSetM addObject:] + 411
7   CoreFoundation                      0x000000010db466a0 -[NSMutableSet unionSet:] + 736
8   BackBoardServices                   0x000000010d0223a3 -[BKSHIDEventRouter addHIDEventDescriptors:] + 38
9   backboardd                          0x000000010c73a881 backboardd + 186497
10  libdispatch.dylib                   0x000000010e862df5 _dispatch_call_block_and_release + 12
11  libdispatch.dylib                   0x000000010e87e4a7 _dispatch_client_callout + 8
12  libdispatch.dylib                   0x000000010e868184 _dispatch_queue_drain + 1048
13  libdispatch.dylib                   0x000000010e867b3c _dispatch_queue_invoke + 595
14  libdispatch.dylib                   0x000000010e869454 _dispatch_root_queue_drain + 565
15  libdispatch.dylib                   0x000000010e869218 _dispatch_worker_thread3 + 98
16  libsystem_pthread.dylib             0x000000010ebaa4f2 _pthread_wqthread + 1129
17  libsystem_pthread.dylib             0x000000010eba8375 start_wqthread + 13
)

EDIT: I also want to stress that this is not simply causing the app to crash, this is causing the WHOLE simulator to reboot. I can also trigger this reboot on a physical device. If this was just a simple case of calling isEqualToString on an NSNull, shouldn't that ONLY crash my app? Not the whole simulator?

Hayden Holligan
  • 1,822
  • 2
  • 19
  • 26
Ceryni
  • 704
  • 1
  • 7
  • 14
  • I'm getting the same error! Somebody else posted a support thread for apple https://forums.developer.apple.com/thread/22087. It happens to me whenever I try to present a popover or similar animation. Still trying to isolate the situation – Hayden Holligan Oct 21 '15 at 19:56
  • Sorry to hear that @HaydenHolligan. I've updated the question to show the steps I'm taking to solve this. Hopefully if/when my issue is solved, we can solve yours and the others. Up-vote this question btw if you think its important. Will help get it visibility. – Ceryni Oct 22 '15 at 03:40

3 Answers3

5

I think I figured it out! I'm pretty sure my problem is the same as yours. Same crash log and situation.

I tried to isolate the problem, so I copied my storyboard into a blank project and removed all connections and made all classes default (no custom classes).

After some playing around, I decided to try to re-link a different split view controller to the same master and detail classes. It works! So I compared all of the settings and literally nothing was different. Damn.

What now? Open the source code. Right click your storyboard in the left pane and select "Open with external editor". This should open up the source code of the storyboard. I compared the source code of the two split view controllers and found a difference.

This is where I looked

<!--Split View Controller-->
    <scene sceneID="X6N-vM-fHn">
        <objects>
            <splitViewController id="xSd-V6-k6W" customClass="SplitViewController" sceneMemberID="viewController">
                <navigationItem key="navigationItem" id="yvV-sB-yKa"/>
                <keyCommands>
                    <keyCommand/>
                </keyCommands>
                <connections>
                    <segue destination="PW6-z0-erU" kind="relationship" relationship="masterViewController" id="MBC-0A-hls"/>
                    <segue destination="xqk-PP-nzR" kind="relationship" relationship="detailViewController" id="sMq-cw-27p"/>
                </connections>
            </splitViewController>
            <placeholder placeholderIdentifier="IBFirstResponder" id="nG8-BB-Qmu" userLabel="First Responder" sceneMemberID="firstResponder"/>
        </objects>
        <point key="canvasLocation" x="-157" y="-370"/>
    </scene>

What's the difference?

<keyCommands>
    <keyCommand/>
</keyCommands>

I don't know what it is, or how it got there, but when I removed those 3 lines the crashes went away. There is a UIKeyCommand class, but I never used it so I'm not sure if it's relevant. Hope this helps!

Hayden Holligan
  • 1,822
  • 2
  • 19
  • 26
  • 1
    Internet points for you sir! Well done, freaking well done. I was parsing through the differences myself but hadn't found them yet. I'll update Apple with this, Scary that this can crash a device. I did not have the exact same view controller, but I DID have the same chunk of keyCommands XML. Removing that fixed my problem. – Ceryni Oct 22 '15 at 21:44
  • You sir, have the kudos from me. I've been ripping my hair out dealing with these Storyboards and the segue problem on IOS9 causing irreparable damage to my soul. Every time I replaced that segue, another would magically disappear, and trying everything down the the point of removing a UIBarButtonItem and doing it programmatically was causing me grief. They would work in iOS7, iOS8, just not iOS9, and not crashing the app, but the entire friggin iPhone/iPad, etc!!!!! Geez. This is leading me to screw Storyboards and just program what I want. – Dr. Polar Humenn Oct 30 '15 at 20:39
  • 2
    The UI for key commands is at the bottom of the Attributes inspector for a view controller. The likely cause is an accidental press of the + button, and not realizing that additional fields should be filled out. Also, the crash for an empty key command appears to be new behavior in iOS 9. radar://23193389 is tracking the root problem here, both in terms of empty key commands not being reported at build time, and UI improvements for configuring key commands. – Quinn Taylor Nov 10 '15 at 06:20
  • Not sure if your solution will work for me yet, but +1 for sharing your hard-found solution! – technophyle Dec 21 '15 at 08:03
0

The log tells you exactly what is wrong.

You are trying to call isEqualToString on a null object.

Check if this object is the object you expect BEFORE calling isEqualToString on it.

However since it used to work of previous OS versions, just checking for null may not solve your issue. You may need to work out why this item is now null where it wasn't before.

Beau Nouvelle
  • 6,962
  • 3
  • 39
  • 54
  • So I agree that this is what the literal error message is reporting, but how do I find where this is happening if none of the stacktraces are linked to my code? They are all sourced in CoreFoundation or backboardd. I have so many exception/error breakpoints my project looks like it has blue chickenpox. – Ceryni Oct 17 '15 at 16:47
  • I would start by searching for isEqualToString in your code and see if the object you're calling it is null. You are right in saying that the entire sim shouldn't be crashing. So there could be some other underlying issue. Is it just your project? Does the sim still crash if you try to run a different project? Have you changed any files inadvertently that are part of the iOS 9 sims, like where they are stored? What about your build settings? Have you tried resetting contents and settings on the simulator, done a clean and cleared derived data? – Beau Nouvelle Oct 17 '15 at 16:55
  • "I would start by searching for isEqualToString in your code" - I put a breakpoint on `isEqualToString`, none of the function calls were being done on NSNulls "Is it just your project? Does the sim still crash if you try to run a different project?" - Just my project, Simulator runs fine for other projects. My project also runs just fine on an 8.4 simulator "Have you changed any files inadvertently that are part of the iOS 9 sims, like where they are stored" - I feared I may have done something weird, so I removed the 9.0 simulator, and added a brand new one. Same results. – Ceryni Oct 17 '15 at 17:20
  • "What about your build settings?" - Not sure about build settings, what would I be checking for there? I'm using cocoapods for dep mgmt. "Have you tried resetting contents and settings on the simulator, done a clean and cleared derived data?" - Referring to the 'Reset Contents and Settings...' option in the ios sim menu? If so, yes I've done that a few times now. – Ceryni Oct 17 '15 at 17:23
-1

As others have mentioned, you are crashing on [NSNull isEqualToString:].

If you are not sure where that is in your code, you can set an exception breakpoint so you know exactly where the crash is. You can do so by going to your Breakpoint Navigator. At the bottom left, there's a + button for you to Add Exception Breakpoint:

enter image description here

Once you have that breakpoint set, run your app again and it should set a breakpoint on where the crash is.

halfer
  • 19,824
  • 17
  • 99
  • 186
yeesterbunny
  • 1,847
  • 2
  • 13
  • 17
  • Thank you for the suggestion, but adding this breakpoint does not catch this error. The simulator still reboots/crashes. – Ceryni Oct 17 '15 at 16:45