App crash when device is not connected to Xcode

I ran into this strange behavior with my iPhone app. It works fine on a device when debugging with Xcode, but when it is launched on a device when the device is not connected to my computer, it fires almost immediately. Needless to say, I find this a bit confusing since I'm not sure how to debug it.

Does anyone have any ideas on what is going on or how to debug this type of problem?

I was looking in the crash report when I reconnect the device and get this:

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000070
Crashed Thread:  6

Thread 6 Crashed:
0   libobjc.A.dylib                 0x300102ac 0x3000c000 + 17068
1   myapp                            0x000033ba 0x1000 + 9146
2   myapp                           0x0000adc8 0x1000 + 40392
3   Foundation                      0x30553356 0x30501000 + 336726
4   Foundation                      0x305025fe 0x30501000 + 5630
5   libSystem.B.dylib               0x31d6a6ea 0x31d46000 + 149226

      

and in the console log the following:

Sun Sep 27 19:59:50 unknown ReportCrash[455] <Notice>: Formulating crash report for process myapp[453]
Sun Sep 27 19:59:50 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:com.yourcompany.myapp[0x2fba]) Job appears to have crashed: Bus error
Sun Sep 27 19:59:50 unknown com.apple.mobile.lockdown[14] <Notice>: Could not receive size of message
Sun Sep 27 19:59:50 unknown lockdownd[14] <Error>: (0x834400) handle_connection: Could not receive internal message #2 from myapp Killing connection
Sun Sep 27 19:59:50 unknown SpringBoard[23] <Warning>: Application 'myapp' exited abnormally with signal 10: Bus error

      

Many thanks

+2


source to share


2 answers


You can always end up on the line of your application where it crashes. Open a terminal in your build folder and run this command:

atos -arch armv6 -o myapp.app/myapp 0x000033ba



and it will return the file and line where it was. This is useful somehow.

+8


source


Just to summarize @ seppo0010's answer and update it for 2011:




First, in Xcode4, the device logs (found in the Organizer window) will show the stream, file, and crash numbers, so atos might not even be needed. Failure can be sorted by application, type and date / time. A typical failure will include the following:
Thread 1 name:  Dispatch queue: someQueue
Thread 1 Crashed:
0   MyApp   0x00003e14 -[MyAppViewController someMethod:withParam1:andParam2:] (MyAppViewController.m:254)

      




But if you decide to use atos, please note the following:
  • Make sure you change the -arch flag to match whatever architecture your code is running on. So, for my iPhone 4, I would enter -arch armv7

    .

  • Xcode 4 puts your build path somewhere else, so don't forget to check Xcode > Prefs > Locations

    . The path to your actual assembly might look something like this:/Users/OldMcStopher/Library/Developer/Xcode/DerivedData/MyApp-someUglyString/Build/Products/Debug-iphoneos

  • The -o flag looks for the actual binary, not just the myapp.app wrapper, so once in the Debug-iphoneos folder (or wherever your debug version of .app lives) set the -o flag to MyApp.app/MyApp

    as @ seppo0010's correct description says.

The atos user page describes it as follows:

The atos command converts numeric addresses to their symbolic equivalents. If full debug information is available, for For example, in .app.dSYM sitting next to .app, then atos output will include the filename and line number information.

It can be found here: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/atos.1.html

(Or from man atos

the terminal.)

+6


source







All Articles