Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you debug an issue with a release mode build in iOS?

Tags:

xcode

ios

I am working on an iOS app and I have noticed a bug that is only reproducible when the app is built in release mode. The only way I have found to run a release mode app that I have built is by building an archive, signing it with my debug profile, and doing an ad-hoc deployment to my device. Using this method however I can't attach with a debugger, and I'm not even sure if I could attach it if it would work well after the release build had run the optimizer on the code.

Does anyone know of a good way to debug an issue that is only reproducible when an app is build in release mode?

like image 782
lehn0058 Avatar asked Jan 22 '13 13:01

lehn0058


2 Answers

Normally Debug builds have optimisation disabled (-O0) to make debugging easier, whereas Release builds have optimisation enabled (-O3 or -Os), which makes the code run much faster, but also makes debugging harder (but not impossible). You can just go into the build settings in Xcode in the Debug configuration and temporarily turn up the optimisation level - this will keep all the other debug goodies (symbols etc) but hopefully also flush out the Release mode bug. (Don't forget to reset the optimisation level to -O0 in the Debug configuration when you're done!)

like image 119
Paul R Avatar answered Sep 29 '22 08:09

Paul R


  1. Go to "Project" command in an Xcode application menu and chose "Edit Scheme"(Shortcut: ⌘< )
  2. Select "Run Project name" in left pane
  3. In right pane, under "Info" tab change "Build Configuration" to "Release"
like image 36
Rahul Wakade Avatar answered Sep 29 '22 08:09

Rahul Wakade