Debugging app on device


What are the best ways to debug an app when you’re testing it on your device. I’ve done a lot of simulator stuff and I was testing my app today “in the field” so to speak and it crashed. So wasn’t sure how to figure out why it crashed? Same for when it goes to TestFlight, is there a method?

Check out the Intermediate Debugging with Xcode 8 tutorial. If your device is connected to your development machine, you can still use Xcode’s debugger to trace through your app.

When an app crashes, it will generate a crash log. Take a look at Demystifying iOS Application Crash Logs for more info on how to access and use these crash logs.

More info available from Apple at Analyzing Crash Reports. They talk about TestFlight as well.

Have fun!

Thanks once more @rcasey!

With regard to this. If you have a crash, but then don’t sync your device straight away and continue some Dev work on your Mac.

Will that create a new version of the binary and when you sync your device later you won’t be able to get a fully symbolicated crash report?

If you edit your project and re-build it, the new binary won’t match up with the one on your device. That causes symbolication to fail.

Check out this excerpt from the Demystifying iOS Application Crash Logs tutorial.

For Xcode to symbolicate a crash log, it needs to have access to the matching application binary that was uploaded to the App Store, and the .dSYM file that was generated when that binary was built. This must be an exact match; otherwise, the report cannot be fully symbolicated.

So, it is essential that you keep each build distributed to users. When you archive your app before submission, Xcode stores your binary. You can find all of your archived applications in the Xcode Organizer under the Archives tab.

You want to keep the archive for any version of your app that you distribute. That will let you symbolicate crash reports.

Have fun!

Hi @rcasey

Still having a little trouble with this. When I go Window → Devices my mac and my iphone pop up along with all the simulators.

When I go Window → Organizer. There’s nothing there. I am just building my app on iphone. No TestFlight stuff or anything :confused: