3

I have small application (game), which works fine when tested on device with Device Development Certificate and also on simulator.

But when app is installed via AdHoc profile, on a particular view, it crashes 50% of the times. Other views works perfectly.

How can I see, what causes the app to crash, as it does not show any log info in AdHoc mode in Xcode.

Thanks.

user3141985
  • 1,395
  • 4
  • 17
  • 36
  • I've had similar crashes happen to me. What I usually do first is change my build configuration in my project's scheme to AdHoc, then run the app on a device. You'll then be able to reproduce the crash and hopefully debug it. – Tim Reddy Jul 09 '14 at 18:41
  • The app crashes if it installed on device using the wrong profile. If I install app using AdHoc profile directly, it does get installed but it crashes instantly. – user3141985 Jul 09 '14 at 18:56
  • 3
    symbolicate crash log(s) and you'll find out – kambala Jul 09 '14 at 19:08

1 Answers1

4

You need to get symbolicated crash logs from your device, which takes a few steps:

  1. Get the crash logs off the device. You can find the logs in Xcode's organizer window. In the organizer, under the devices tab you should see various devices that have at one point or another been attached to your computer. Under some or all of those devices there will be a "Device Logs" listing. If you select the Device Logs for any device you'll see a list of crash logs from that device. The logs for crashes that occurred in ad-hoc distributed apps will usually not be symbolicated, because the archive build will usually have been done with a Release build configuration, and the Release configuration that Xcode sets up for you in a new app project happens to strip debug symbols from the built product.

  2. The archive you created before distributing ad-hoc is actually just a ZIP file. From Xcode, show the archive in the finder, and change the archive file's extension to "zip" so you can unpack it in the finder (or just point unzip at the file from the command line, either way you just need to get your archive unpacked).

  3. In the Payload directory of your now unpacked archive, you should find your app bundle. You need to take that app bundle and put it next to the dSYM bundle generated when you built your project for archiving, somewhere that Spotlight can find them. If you just put the app and the dSYM next to each other in some folder in your home directory, that should do the trick.

  4. Finally, in the Xcode organizer, under Device Logs, select the crash report you need to symbolicate and click the "Re-Symbolicate" button down at the bottom of the Xcode window.

If you don't have the dSYM bundle from your archive build, you may need to build for archiving again and this time, in the build log, look for the "Generate foo.dSYM" step (should be one of the last, or the last step, before "Build succeeded"). If you expand the command for that step you should be able to see where the dSYM was generated. Just save it off somewhere so you'll have it for later. Then ad-hoc distribute and install your newly built archive, reproduce the crash, and follow steps 1-4 above to symbolicate the new crash log.

Of course there's more to do once you've got the symbolicated crash log, to actually fix the crash, but getting the symbolicated log is an important first step. The symbolicated log will show you what the stack looked like when the crash occurred and help you pinpoint the relevant code.

Aaron Golden
  • 7,092
  • 1
  • 25
  • 31
  • Thanks for detailed answer for how to get the logs and find the reason. Mean while I was able to locate the problem, I was using this [http://stackoverflow.com/questions/1451342/objective-c-find-caller-of-method/9603733#9603733] piece of code, when commented out, AdHoc version of apps now works perfectly. – user3141985 Jul 10 '14 at 17:34