Debug a frozen app

A user says my distributed app is freezing up after a few seconds. I don't have access to his phone.


I have no clue how to debug a problem like this from afar.


My only thought is if the user could do something to the app to make it crash...then I woud get a crash log.


But I can't find anyone who can tell me how to make an app crash (other than in code).


Any ideas?


Perhaps I could give him a TestFlight version of the app that contains a timer that would programatically force a crash after 10 seconds?

Answered by DTS Engineer in 402292022

But I can't find anyone who can tell me how to make an app crash (other than in code).

Back in the day there was a force quit gesture (different from the ‘remove the app from the multitasking UI’ gesture that you’re almost certainly familiar with) but that’s gone by the wayside, alas.

Perhaps I could give him a TestFlight version of the app that contains a timer that would programatically force a crash after 10 seconds?

There’s no guarantee that’ll work; it depends on how badly the app is hung. If you take this path, make sure not to use a run loop based timer, as whatever’s hanging the app may well prevent that from running. Instead, use a Dispatch timer that targets something other than the main queue.

However, they may be better ways:

  • Pressing the Home button will cause the system to try to suspend the app. If the app is non-responsive, it won’t respond to that suspend request and shortly thereafter it’ll be killed by the watchdog. And that should generate a crash report.

  • You could ask for a sysdiagnose log. That may contain a spin trace for the hung app.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer

But I can't find anyone who can tell me how to make an app crash (other than in code).

Back in the day there was a force quit gesture (different from the ‘remove the app from the multitasking UI’ gesture that you’re almost certainly familiar with) but that’s gone by the wayside, alas.

Perhaps I could give him a TestFlight version of the app that contains a timer that would programatically force a crash after 10 seconds?

There’s no guarantee that’ll work; it depends on how badly the app is hung. If you take this path, make sure not to use a run loop based timer, as whatever’s hanging the app may well prevent that from running. Instead, use a Dispatch timer that targets something other than the main queue.

However, they may be better ways:

  • Pressing the Home button will cause the system to try to suspend the app. If the app is non-responsive, it won’t respond to that suspend request and shortly thereafter it’ll be killed by the watchdog. And that should generate a crash report.

  • You could ask for a sysdiagnose log. That may contain a spin trace for the hung app.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks very much Quinn! Good ideas. And I didn't know about sysdiagnose.


Barry

A follow-up if I may.


I gave my user a TestFlight version and we're narrowing down the problem. When I look in AppStoreConnect it shows that I have 4 Crashes on the beta version. (I was concerned that it was actually crashing, but the user tells me that when he kills the hung app, it is considered a Crash and lets him put in comments for the "crash".)


That's all well and good, but when I go into XCode organizer, the Crashes page works on Downloading and then says "No Crashes" (yes, I've set the version/build number correctly). I know A-S-Connect says it may take 72 hours; does this mean that it may know about the crashes and XCode doesn't for that long, or they should be in both places now that they're in App Store Connect?


Since the "crash" was generated by him killing the app, will it still give me something in XCode to look at?

Since the "crash" was generated by him killing the app, will it still give me something in XCode to look at?

I don’t know the answer to this, alas (I don’t lot of experience with TestFlight). You should ask the user to check in Settings > Privacy > Analytics > Analytics Data to see if there’s a report there.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I ended up begging the user to send Crash logs, which he did, and we've resolved the problems. (SIG_KILL also provides useful crash logs.)


I still have only one log in Organizer. I've opened ticket FB7545163 about my missing logs.


Barry

Debug a frozen app
 
 
Q