简体   繁体   English

iPhone应用程序崩溃后如何读取日志

[英]How to read logs after iPhone app crash

Here is my situation: 这是我的情况:

I have an app (let's call it MyApp) that has push integrated. 我有一个集成了推送功能的应用程序(我们称之为MyApp)。 When the app comes back from background, I launch the method to register users with push. 当应用程序从后台返回时,我启动了通过push注册用户的方法。 The app was tested in developer mode for a long time and it worked well. 该应用已在开发人员模式下测试了很长时间,并且运行良好。

Today the app was released by Apple. 今天,该应用程序由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 它一直崩溃,但仅在某些情况下会崩溃:-在3G,Edge或GPRS中,应用程序将在开始屏幕后立即崩溃-在WiFi或飞行模式下,应用程序将按预期运行

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!). 我还发现,该应用程序在连接到您无权访问的WiFi时可以正常工作(出现WiFi信号后,即使您无法使用LAN浏览互联网,该应用程序也不再崩溃)已连接!)。

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! 如前所述,在开发人员中(在Simulator和iPhone上),它将可以正常工作!

I really appreciate your tips! 我非常感谢您的提示!

Suggestions : 意见建议

  • Problem somewhere in reachability file 可达性文件中的某处问题
  • Problem after launching "registerForRemoteNotificationTypes" 启动“ 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:
[...]

I see that the problem is in Reachability class. 我看到问题出在可达性类中。 Obviously it is here: 显然它在这里:

PrintReachabilityFlags(flags, "networkStatusForFlags");

So the problem is with "networkStatusForFlags" string. 因此问题出在"networkStatusForFlags"字符串上。 It crashes during length calculation probably because instead of '\\0' character in the end there is some garbage and some extra memory is accessed. 它在长度计算期间崩溃,可能是因为最后没有代替'\\ 0'字符而是有一些垃圾并且访问了一些额外的内存。 Try to change it like this: 尝试像这样更改它:

PrintReachabilityFlags(flags, "networkStatusForFlags\0");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM