Ios 异常类型:00000020和崩溃线程4是否相关?

Ios 异常类型:00000020和崩溃线程4是否相关?,ios,iphone,objective-c,cocoa-touch,Ios,Iphone,Objective C,Cocoa Touch,事实上,这种崩溃并不是每次都会发生,甚至不是经常发生,但我们的生产应用程序中出现了这种崩溃。我不确定问题出在哪里。它告诉我们,在第38行环境中的线程4中正在发生崩溃 Code: NSBundle* bundle = [NSBundle mainBundle]; NSString* envsPListPath = [bundle pathForResource:@"Environment" ofType:@"plist"]; Line 38: NSDictionary *environme

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

Code:

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

Line 38:
NSDictionary *environments = [[NSDictionary alloc] initWithContentsOfFile:envsPListPath];
但根据异常类型:00000020,应用程序未能及时启动。 我不明白上面的代码有什么问题。请帮我找出b/w看门狗崩溃和以上代码行之间的关系

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

做一件事,像下面那样修改代码并进行测试

    if([[NSFileManager DefaultManger] 
      fileExistAtPath:envsPListPath]){
     NSDictionary *environments = [[NSDictionary
    dictionaryWithContentsOfFile:envsPListPath];
    }

做一件事,像下面那样修改代码并进行测试

    if([[NSFileManager DefaultManger] 
      fileExistAtPath:envsPListPath]){
     NSDictionary *environments = [[NSDictionary
    dictionaryWithContentsOfFile:envsPListPath];
    }

简单地说,异常类型20意味着您正在主线程上进行异步联网,当连接或操作缓慢时,应用程序可以通过iOS终止。这将随机发生。见本说明:


简单地说,异常类型20表示您正在主线程上进行异步联网,当连接或操作缓慢时,应用程序可以通过iOS终止。这将随机发生。见本说明:


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

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    dispatch_async(dispatch_get_main_queue(), ^{
        // run that crashing thread here.
    });
});

找到应用程序正在崩溃的线程并将该线程放入

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    dispatch_async(dispatch_get_main_queue(), ^{
        // run that crashing thread here.
    });
});

如果在崩溃日志中获得异常类型:00000020和异常代码:0x8badf00d,则它是看门狗超时崩溃报告。

当您在主线程上同步执行活动时,就会发生这种情况。 解决方法是在主线程上异步使用


这提供了有关此崩溃的详细信息。

如果在崩溃日志中获得
异常类型:00000020
异常代码:0x8badf00d
,则它是看门狗超时崩溃报告。

当您在主线程上同步执行活动时,就会发生这种情况。 解决方法是在主线程上异步使用


这提供了关于这次车祸的详细信息。

你说车祸不是一直发生的。您是否检查了所有崩溃日志,以查看设备和操作系统版本是否每次都相同。上面的日志说它是一个运行iOS 6.1.3的iPod,如果它总是在同一个设备和iOS组合上,那么可能值得对该设备和iOS版本进行测试和调试on@AdamRichardson是的,我在iPod上测试过,但iOS 6.0.1版本。就连我也无法重现这个问题。你说坠机并非一直都在发生。您是否检查了所有崩溃日志,以查看设备和操作系统版本是否每次都相同。上面的日志说它是一个运行iOS 6.1.3的iPod,如果它总是在同一个设备和iOS组合上,那么可能值得对该设备和iOS版本进行测试和调试on@AdamRichardson是的,我在iPod上测试过,但iOS 6.0.1版本。即使我也无法重现问题。无论如何,我无法重现问题,但出于安全考虑,我可以编写此代码。谢谢你的帮助。如果路径为空,它会崩溃吗?是的,为了安全起见,如果文件名不存在,那么它肯定会抛出异常,并增加崩溃的可能性。如果您使用某种工具进行测试,并且如果filename为空,那么您可以通过提供空字符串轻松看到我测试的crashYes。它正在崩溃。但是崩溃日志与我在这里发布的不同。这意味着两种崩溃是不同的。是的,这就是如果我使用的条件是,如果发现为空,那么它将不会崩溃。无论如何,我无法重现问题,但为了安全起见,我可以编写此代码。谢谢你的帮助。如果路径为空,它会崩溃吗?是的,为了安全起见,如果文件名不存在,那么它肯定会抛出异常,并增加崩溃的可能性。如果您使用某种工具进行测试,并且如果filename为空,那么您可以通过提供空字符串轻松看到我测试的crashYes。它正在崩溃。但是崩溃日志与我在这里发布的不同。这意味着两种崩溃是不同的。是的,这就是如果我使用的条件是空的,那么它不会崩溃。