How to read logs after iPhone app crash

1

Here is my situation:

I have an app (let's call it MyApp) that has push integrated. When the app comes back from background, I launch the method to register users with push. The app was tested in developer mode for a long time and it worked well.

Today the app was released by Apple. But the app doesn't work anymore. It crashes all the time, but only under certain circumstances: - in 3G, Edge or GPRS the app will crash right after the start screen - in WiFi or airplane mode the app will work as expected

I also discovered that the app will work when connected to a WiFi that you don't have access (as soon as the WiFi sign appears, the app doesn't crash anymore, even if you can't browse the internet with the LAN you are connected to!).

I hope you can help me with the error messages, I don't quite understand how to get rid of the app crash. As mentioned, in developer (on Simulator and on my iPhone) it will work properly!

I really appreciate your tips!

Suggestions:

  • Problem somewhere in reachability file
  • Problem after launching "registerForRemoteNotificationTypes"

Logfile

Incident Identifier: CD5D1DFA-75E7-4042-B8C6-4DA8F2477852
CrashReporter Key:   639f660a06c84202b5bc3666882fda8532a610b3
Hardware Model:      iPhone3,1
Process:         myApp [1296]
Path:            /var/mobile/Applications/06B7C009-BB46-4473-9221-C8924C3D7A81/myApp.app/myApp
Identifier:      myApp
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2011-03-01 08:32:00.598 +0100
OS Version:      iPhone OS 4.2.1 (8C148)
Report Version:  104

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

Thread 0 Crashed:
0   libSystem.B.dylib               0x33b5fa3c strlen + 12
1   CoreFoundation                  0x33a3e42e __CFStringAppendFormatCore + 2386
2   CoreFoundation                  0x33a3daac _CFStringCreateWithFormatAndArgumentsAux + 64
3   CoreFoundation                  0x33a5a924 _CFLogvEx + 64
4   Foundation                      0x33625738 NSLogv + 56
5   Foundation                      0x336256ec NSLog + 16
6   myApp                           0x0000e42c PrintReachabilityFlags (Reachability.m:25)
7   myApp                           0x0000e446 -[Reachability networkStatusForFlags:] (Reachability.m:147)
8   myApp                           0x0000e518 -[Reachability currentReachabilityStatus] (Reachability.m:198)
9   myApp                           0x000030f4 -[myAppAppDelegate configureTextField:imageView:reachability:] (myAppAppDelegate.m:278)
10  myApp                           0x00003354 -[myAppAppDelegate updateInterfaceWithReachability:] (myAppAppDelegate.m:274)
11  myApp                           0x00003bca -[myAppAppDelegate applicationDidFinishLaunching:] (myAppAppDelegate.m:25)
12  UIKit                           0x3209ebfa -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 826
13  UIKit                           0x3209a252 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 266
14  UIKit                           0x32066484 -[UIApplication handleEvent:withNewEvent:] + 1108
15  UIKit                           0x32065ec2 -[UIApplication sendEvent:] + 38
16  UIKit                           0x32065900 _UIApplicationHandleEvent + 5084
17  GraphicsServices                0x33b0eefc PurpleEventCallback + 660
18  CoreFoundation                  0x33a556f8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20
19  CoreFoundation                  0x33a556bc __CFRunLoopDoSource1 + 160
20  CoreFoundation                  0x33a47f76 __CFRunLoopRun + 514
21  CoreFoundation                  0x33a47c80 CFRunLoopRunSpecific + 224
22  CoreFoundation                  0x33a47b88 CFRunLoopRunInMode + 52
23  UIKit                           0x32099302 -[UIApplication _run] + 374
24  UIKit                           0x32096e8c UIApplicationMain + 664
25  myApp                           0x00003082 main (main.m:13)
26  myApp                           0x00003018 start + 44

Thread 1:
0   libSystem.B.dylib               0x33b89974 kevent + 24
1   libSystem.B.dylib               0x33c33704 _dispatch_mgr_invoke + 88
2   libSystem.B.dylib               0x33c33174 _dispatch_queue_invoke + 96
3   libSystem.B.dylib               0x33c32b98 _dispatch_worker_thread2 + 120
4   libSystem.B.dylib               0x33bd724a _pthread_wqthread + 258
5   libSystem.B.dylib               0x33bcf970 start_wqthread + 0

Thread 2:
0   libSystem.B.dylib               0x33bd79e0 __workq_kernreturn + 8
1   libSystem.B.dylib               0x33bd7364 _pthread_wqthread + 540
2   libSystem.B.dylib               0x33bcf970 start_wqthread + 0

Thread 3:
0   libSystem.B.dylib               0x33b5d268 mach_msg_trap + 20
1   libSystem.B.dylib               0x33b5f354 mach_msg + 44
2   CoreFoundation                  0x33a48648 __CFRunLoopServiceMachPort + 88
3   CoreFoundation                  0x33a47ed2 __CFRunLoopRun + 350
4   CoreFoundation                  0x33a47c80 CFRunLoopRunSpecific + 224
5   CoreFoundation                  0x33a47b88 CFRunLoopRunInMode + 52
6   WebCore                         0x304df124 RunWebThread(void*) + 332
7   libSystem.B.dylib               0x33bd6886 _pthread_start + 242
8   libSystem.B.dylib               0x33bcba88 thread_start + 0

Thread 0 crashed with ARM Thread State:
    r0: 0x00050000    r1: 0x00000024      r2: 0x00000027      r3: 0x00000003
    r4: 0x00000000    r5: 0x00050003      r6: 0x00000001      r7: 0x2fdfe348
    r8: 0x2fdfd64c    r9: 0x00000002     r10: 0x00000000     r11: 0x00000000
    ip: 0x00050003    sp: 0x2fdfd43c      lr: 0x33a3e435      pc: 0x33b5fa3c
  cpsr: 0x200f0010

Binary Images:
[...]
iphone
objective-c
logging
exc-bad-access
apple-push-notifications
asked on Stack Overflow Mar 1, 2011 by andreas

1 Answer

1

I see that the problem is in Reachability class. Obviously it is here:

PrintReachabilityFlags(flags, "networkStatusForFlags");

So the problem is with "networkStatusForFlags" string. It crashes during length calculation probably because instead of '\0' character in the end there is some garbage and some extra memory is accessed. Try to change it like this:

PrintReachabilityFlags(flags, "networkStatusForFlags\0");
answered on Stack Overflow Mar 1, 2011 by Max

User contributions licensed under CC BY-SA 3.0