2

实际上,这种崩溃并不是每次都重现,甚至不是经常重现,但我们在生产应用程序中遇到了这种崩溃。我不确定问题出在哪里。它告诉环境类第 38 行的线程 4 中发生了崩溃。

Code:

 NSBundle* bundle = [NSBundle mainBundle];
 NSString* envsPListPath = [bundle pathForResource:@"Environment" ofType:@"plist"];

Line 38:
NSDictionary *environments = [[NSDictionary alloc] initWithContentsOfFile:envsPListPath];

但根据异常类型:00000020 ,应用程序未能及时启动。我不明白上面的代码有什么问题。请帮助我解决黑白看门狗崩溃和以上代码行的关系。

Crash Log: 

  Incident Identifier: FBDC0D68-9EC3-423C-A0DF-CD08EA079215
    Hardware Model:      iPod4,1
    Process:         Sparkle [16542]
    Path:            /var/mobile/Applications/55887817-5FD2-479A-B124-6ABF1907B339/Sparkle.app/Sparkle
    Identifier:      Sparkle
    Version:         ??? (???)
    Code Type:       ARM (Native)
    Parent Process:  launchd [1]

    Date/Time:       2013-10-26 14:30:43.046 -0400
    OS Version:      iOS 6.1.3 (10B329)
    Report Version:  104

    Exception Type:  00000020
    Exception Codes: 0x000000008badf00d
    Highlighted Thread:  4

    Application Specific Information:
    com.xxxx.xxx failed to launch in time

    Elapsed total CPU time (seconds): 15.060 (user 15.060, system 0.000), 50% CPU 
    Elapsed application CPU time (seconds): 1.756, 6% CPU

    Thread 0 name:  Dispatch queue: com.apple.main-thread
    Thread 0:
    0   libsystem_kernel.dylib          0x3a106eb4 mach_msg_trap + 20
    1   libsystem_kernel.dylib          0x3a107048 mach_msg + 36
    2   UIKit                           0x33ebb7e6 _UIPasteboardServerCreate + 158
    3   UIKit                           0x33ebb684 UIPasteboardServerCreate + 208
    4   UIKit                           0x33ebb54a -[UIPasteboard(Static) _initWithName:system:create:] + 90
    5   UIKit                           0x34055d9c +[UIPasteboard pasteboardWithName:create:] + 292
    6   Sparkle                         0x0049fe8a -[ADMS_Churn readFacebookReferrer] + 42
    7   Sparkle                         0x0049f5ac -[ADMS_Churn setInstallVariables] + 204
    8   Sparkle                         0x0049f2b0 -[ADMS_Churn setLaunchTypeVariables] + 68
    9   Sparkle                         0x0049ead4 -[ADMS_Churn trackSessionStart] + 40
    10  Sparkle                         0x0049ea56 -[ADMS_Churn resumeSession] + 46
    11  Sparkle                         0x004a7ae4 -[ADMS_NotificationHandler handleApplicationNotifications:] + 112
    12  CoreFoundation                  0x31eec034 _CFXNotificationPost + 1424
    13  Foundation                      0x32802594 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
    14  UIKit                           0x33e03896 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1754
    15  UIKit                           0x33dfb846 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 694
    16  UIKit                           0x33da3c34 -[UIApplication handleEvent:withNewEvent:] + 1000
    17  UIKit                           0x33da36c8 -[UIApplication sendEvent:] + 68
    18  UIKit                           0x33da3116 _UIApplicationHandleEvent + 6150
    19  GraphicsServices                0x35a955a0 _PurpleEventCallback + 588
    20  GraphicsServices                0x35a951ce PurpleEventCallback + 30
    21  CoreFoundation                  0x31f70170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
    22  CoreFoundation                  0x31f70112 __CFRunLoopDoSource1 + 134
    23  CoreFoundation                  0x31f6ef94 __CFRunLoopRun + 1380
    24  CoreFoundation                  0x31ee1eb8 CFRunLoopRunSpecific + 352
    25  CoreFoundation                  0x31ee1d44 CFRunLoopRunInMode + 100
    26  UIKit                           0x33dfa480 -[UIApplication _run] + 664
    27  UIKit                           0x33df72fc UIApplicationMain + 1116
    28  Sparkle                         0x003fafd2 main (main.m:18)
    29  libdyld.dylib                   0x3a050b1c start + 0

    Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
    Thread 1:
    0   libsystem_kernel.dylib          0x3a107648 kevent64 + 24
    1   libdispatch.dylib               0x3a0404ec _dispatch_mgr_invoke + 792
    2   libdispatch.dylib               0x3a032df4 _dispatch_mgr_thread$VARIANT$up + 32

    Thread 2:
    0   libsystem_kernel.dylib          0x3a117d98 __workq_kernreturn + 8
    1   libsystem_c.dylib               0x3a065cf6 _pthread_workq_return + 14
    2   libsystem_c.dylib               0x3a065a12 _pthread_wqthread + 362
    3   libsystem_c.dylib               0x3a0658a0 start_wqthread + 4

    Thread 3 name:  WebThread
    Thread 3:
    0   libsystem_kernel.dylib          0x3a106eb4 mach_msg_trap + 20
    1   libsystem_kernel.dylib          0x3a107048 mach_msg + 36
    2   CoreFoundation                  0x31f70040 __CFRunLoopServiceMachPort + 124
    3   CoreFoundation                  0x31f6ed9e __CFRunLoopRun + 878
    4   CoreFoundation                  0x31ee1eb8 CFRunLoopRunSpecific + 352
    5   CoreFoundation                  0x31ee1d44 CFRunLoopRunInMode + 100
    6   WebCore                         0x37ecf500 RunWebThread(void*) + 440
    7   libsystem_c.dylib               0x3a07030e _pthread_start + 306
    8   libsystem_c.dylib               0x3a0701d4 thread_start + 4

    Thread 4 name:  Dispatch queue: momentumMapQueue
    Thread 4:
    0   libsystem_c.dylib               0x3a060332 szone_malloc_should_clear + 110
    1   libsystem_c.dylib               0x3a060290 malloc_zone_malloc + 68
    2   CoreFoundation                  0x31eda712 _CFRuntimeCreateInstance + 210
    3   CoreFoundation                  0x31f7953a __CFStringCreateImmutableFunnel3 + 1882
    4   CoreFoundation                  0x31edd6c6 CFStringCreateWithBytes + 46
    5   CoreFoundation                  0x31effe76 _uniqueStringForUTF8Bytes + 90
    6   CoreFoundation                  0x31effd40 parseStringTag + 1304
    7   CoreFoundation                  0x31efe930 parseXMLElement + 2760
    8   CoreFoundation                  0x31efdc8e getContentObject + 450
    9   CoreFoundation                  0x31efe6aa parseXMLElement + 2114
    10  CoreFoundation                  0x31efdc8e getContentObject + 450
    11  CoreFoundation                  0x31efe6aa parseXMLElement + 2114
    12  CoreFoundation                  0x31efdc8e getContentObject + 450
    13  CoreFoundation                  0x31efe1c4 parseXMLElement + 860
    14  CoreFoundation                  0x31f0a044 _CFPropertyListCreateFromUTF8Data + 1592
    15  CoreFoundation                  0x31edcfb6 _CFPropertyListCreateWithData + 882
    16  CoreFoundation                  0x31edcbe0 CFPropertyListCreateFromXMLData + 116
    17  Foundation                      0x328114ea +[NSDictionary(NSDictionary) newWithContentsOf:immutable:] + 110
    18  Sparkle                         0x006c4f66 -[Environments initializeSharedInstance] (Environments.m:38)
    19  Sparkle                         0x006c4d54 +[Environments sharedInstance] (Environments.m:27)
    20  Sparkle                         0x006c4992 +[ConfigurationManager getLogLevel:] (ConfigurationManager.m:54)
    21  Sparkle                         0x006c4870 +[ConfigurationManager logLevelForFileName:] (ConfigurationManager.m:21)
    22  Sparkle                         0x006e824a -[NTRequestPolicy init] (NTRequestPolicy.m:38)
    23  Sparkle                         0x006e80f6 +[NTRequestPolicy sharedRequestPolicy] (NTRequestPolicy.m:24)
    24  Sparkle                         0x004f5fe8 +[WAGServiceHandler execute:requestObject:responseClass:serviceCallBack:requestType:additionalHTTPHeaders:backgroundRequest:] (WAGServiceHandler.m:39)
    25  Sparkle                         0x004f5ed0 +[WAGServiceHandler execute:requestObject:responseClass:serviceCallBack:requestType:] (WAGServiceHandler.m:26)
    26  Sparkle                         0x004f5e72 +[WAGServiceHandler execute:requestObject:responseClass:serviceCallBack:] (WAGServiceHandler.m:20)
    27  Sparkle                         0x0040acaa -[Mbox load] (Mbox.m:118)
    28  Sparkle                         0x0040bf52 -[MBoxHandler invokeMboxManager] (MBoxHandler.m:47)
    29  Sparkle                         0x0040d548 __39-[MomentumMapPlugIn downloadIconImages]_block_invoke (MomentumMapPlugIn.m:222)
    30  libdispatch.dylib               0x3a03111c _dispatch_call_block_and_release + 8
    31  libdispatch.dylib               0x3a030996 _dispatch_queue_drain$VARIANT$up + 142
    32  libdispatch.dylib               0x3a030890 _dispatch_queue_invoke$VARIANT$up + 32
    33  libdispatch.dylib               0x3a03f212 _dispatch_root_queue_drain + 190
    34  libdispatch.dylib               0x3a03f3b4 _dispatch_worker_thread2 + 80
    35  libsystem_c.dylib               0x3a065a0e _pthread_wqthread + 358
    36  libsystem_c.dylib               0x3a0658a0 start_wqthread + 4
4

4 回答 4

2

简单来说,Exception Type 20 表示你在主线程上做异步联网,当连接或操作很慢时,App 会被 iOS 终止。这将随机发生。请参阅此注释:

https://developer.apple.com/library/ios/qa/qa1693/_index.html

于 2014-11-11T16:03:58.517 回答
2

如果你得到Exception Type: 00000020并且Exception Codes: 0x8badf00d在你的崩溃日志中,那么它就是看门狗超时崩溃报告。

当您在主线程上同步执行活动时会发生这种情况。 对此的修复是在主线程上异步使用。

此错误的屏幕截图

Apple 文档详细提供了有关此崩溃的详细信息。

于 2016-04-15T10:46:37.660 回答
0

做一件事修改您的代码,如下所示并进行测试。

    if([[NSFileManager DefaultManger] 
      fileExistAtPath:envsPListPath]){
     NSDictionary *environments = [[NSDictionary
    dictionaryWithContentsOfFile:envsPListPath];
    }
于 2013-11-07T10:26:23.870 回答
0

查找您的应用程序崩溃的线程并将该线程放入

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    dispatch_async(dispatch_get_main_queue(), ^{
        // run that crashing thread here.
    });
});
于 2015-09-24T11:23:42.673 回答