Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App crashes on device but XCode doesn't register a crash

I have my device plugged in and I'm running my app through XCode. At a certain point, the app crashes on the device and exits out to the home screen. However, Xcode still shows the app as "Running" and I have the option to click "Stop" - it is not grayed out. No error message is printed to the console, and no crash log is saved to the device log.

I need to fix the crash, but without an error message I'm having a hard time tracking down the problem. I've placed NSLog statements in key areas of the code but haven't gotten any closer to figuring out what is causing the crash.

Does anybody know anything about the strange fact that XCode doesn't know that my app has crashed and still shows the app as "Running"?

like image 452
RanLearns Avatar asked Jan 18 '23 08:01

RanLearns


2 Answers

To help with the debugging part of your question, you can set "Strip Debug Symbols" to "No" in your build settings:

ss

and then you will be able to see a symbolicated crash log in the "Device Logs" section of the Organizer window:

ss2

like image 83
chown Avatar answered Jan 20 '23 20:01

chown


If the app is signed for distribution, X-Code can't debug it. Launching the app onto a device results in X-Code not being able to get a process id.

You can still get your log messages (and other console messages, hopefully including crash information) via the organizer -> devices -> console.

If your app is signed for development and this is still a problem, you have a deeper issue here that is causing X-Code to think that your app wasn't able to start. Look into how long it takes your app to initialize; I've had issues where load times > 10 seconds left X-Code not getting a process ID but the app still running.

Worse case scenario, load NSLog messages like crazy, install the app and run it until it crashes. Then immediately load organizer, go to the device, and download the console, then look for any crash logs.

Best of luck!

like image 27
Geekswordsman Avatar answered Jan 20 '23 21:01

Geekswordsman