如何在启动时debuggingiOS应用程序崩溃,仅在程序集文件中产生断点

我正在面对一个正在开发的应用程序的问题。 问题是,应用程序在启动时崩溃了一段时间,只有在这种情况下。 在杀死应用程序时启动应用程序不会导致崩溃,从debugging器或电话。 在后台启动应用程序约5-10分钟不会导致崩溃,而不是debugging。 在backgorund启动应用程序大约15-20分钟导致崩溃。 对exception使用debugging器和断点给了我这个文件:

libdispatch.dylib`_dispatch_assert_queue_fail: 0x349c6ce4: push {r4, r5, r7, lr} 0x349c6ce6: add r7, sp, #0x8 0x349c6ce8: sub sp, #0xc 0x349c6cea: movw r5, #0x7810 0x349c6cee: mov r4, r0 0x349c6cf0: movt r5, #0x1 0x349c6cf4: movw r12, #0x7af0 0x349c6cf8: movt r12, #0x1 0x349c6cfc: movw r9, #0x7a83 0x349c6d00: movt r9, #0x1 0x349c6d04: ldr r0, [r4, #0x48] 0x349c6d06: movw r2, #0x7a93 0x349c6d0a: movt r2, #0x1 0x349c6d0e: movw r3, #0x7af5 0x349c6d12: movt r3, #0x1 0x349c6d16: add r5, pc 0x349c6d18: cmp r0, #0x0 0x349c6d1a: it ne 0x349c6d1c: movne r5, r0 0x349c6d1e: add r12, pc 0x349c6d20: add r9, pc 0x349c6d22: add r3, pc 0x349c6d24: cmp r1, #0x0 0x349c6d26: add r2, pc 0x349c6d28: strd r4, r5, [sp] 0x349c6d2c: it ne 0x349c6d2e: movne r3, r12 0x349c6d30: add r0, sp, #0x8 0x349c6d32: mov r1, r9 0x349c6d34: blx 0x349dda4c ; symbol stub for: -[OS_object retainWeakReference] 0x349c6d38: movw r0, #0x7ae0 0x349c6d3c: movt r0, #0x1 0x349c6d40: ldr r1, [sp, #0x8] 0x349c6d42: add r0, pc 0x349c6d44: bl 0x349c65cc ; _dispatch_log 0x349c6d48: trap 0x349c6d4a: nop 

debugging器在陷阱线上断开,就在nop结尾处:

 Thread 1: EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xdefe) 

我无法find关于如何debugging的线索。

任何帮助,将不胜感激。

编辑:这是一个崩溃日志与堆栈跟踪(我用DeviceName和应用程序名称,我的公司名称与com.company.myAppNamereplace我的设备名称):

 Sep 22 11:36:31 DeviceName locationd[63] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0 Sep 22 11:36:31 DeviceName myAppName[6750] <Warning>: *** Assertion failure in -[UIFetchContentInBackgroundAction sendResponse:], /SourceCache/BaseBoard/BaseBoard-97/BaseBoard/BSAction.m:221 Sep 22 11:36:32 DeviceName myAppName[6750] <Notice>: BUG in client of libdispatch: Assertion failed: Block was run on an unexpected queue Expected queue: 0x0x3713cd40[com.apple.main-thread] Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument) Sep 22 11:36:32 DeviceName ReportCrash[6766] <Notice>: ReportCrash acting against PID 6750 Sep 22 11:36:32 DeviceName diagnosticd[5999] <Error>: error evaluating process info - pid: 6750, punique: 6750 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Notice>: Formulating crash report for process myAppName[6750] Sep 22 11:36:32 DeviceName SpringBoard[2836] <Warning>: BSXPCMessage received error for message: Connection invalid Sep 22 11:36:32 DeviceName wifid[68] <Notice>: WiFi:[433071392.290519]: BG Application: Not Present, BG Daemon: Present. Daemons: lockdownd networkd assistantd Sep 22 11:36:32 DeviceName com.apple.xpc.launchd[1] (UIKitApplication:com.company.myAppName[0x3ff0][6750]) <Notice>: Service exited due to signal: Trace/BPT trap: 5 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Not saving crash log because we have reached the limit for logs to store on disk. Sync or otherwise clear logs from /var/mobile/Library/Logs/CrashReporter to save new logs. Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Could not save crash report to disk! Sep 22 11:36:32 DeviceName SpringBoard[2836] <Warning>: Application 'UIKitApplication:com.company.myAppName[0x3ff0]' crashed. Sep 22 11:36:32 DeviceName assertiond[57] <Warning>: Could not set priority of <BKNewProcess: 0x145437b0; com.company.myAppName; pid: 6750> to 2, priority: No such process Sep 22 11:36:32 DeviceName assertiond[57] <Warning>: Could not set priority of <BKNewProcess: 0x145437b0; com.company.myAppName; pid: 6750> to 4096, priority: No such process Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Incident Identifier: DF8D30C9-4F46-43CB-B192-323E819180A6 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: CrashReporter Key: a93a18a1167cbedc4b3623154bd083fdd7770808 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Hardware Model: iPhone5,2 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Process: myAppName [6750] Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Path: /private/var/mobile/Containers/Bundle/Application/DE60F941-317E-49C2-95EA-0F152A117C16/myAppName.app/myAppName Sep 22 11:36:32 DeviceName UserEventAgent[17] <Warning>: id=com.company.myAppName pid=6750, state=0 Sep 22 11:36:32 DeviceName backboardd[56] <Warning>: Unable to bootstrap_look_up port with name com.company.myAppName.gsEvents: unknown error code (1102) Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Identifier: myAppName Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Version: ??? Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Code Type: ARM (Native) Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Parent Process: launchd [1] Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Date/Time: 2014-09-22 11:36:32.054 +0200 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Launch Time: 2014-09-22 11:25:29.726 +0200 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: OS Version: iOS 8.0 (12A365) Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Report Version: 105 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Exception Type: EXC_BREAKPOINT (SIGTRAP) Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Exception Codes: 0x0000000000000001, 0x000000000000defe Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Triggered by Thread: 0 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Last Exception Backtrace: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: (0x26db3e3a 0x34461c86 0x26db3d10 0x27a845aa 0x2b8bf8c8 0x349c8b64 0x2b8bf832 0x2a7c7ba8 0x349c18c6 0x349c18b2 0x349c50ba 0x26d79be4 0x26d782e4 0x26cc661c 0x26cc642e 0x2e0740a4 0x2a2b0804 0xcee48 0x349e1aaa) Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 0 Crashed: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libdispatch.dylib 0x349c6d48 0x349c0000 + 27976 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 libdispatch.dylib 0x349c4be4 0x349c0000 + 19428 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 FrontBoardServices 0x2d4e7830 0x2d4df000 + 34864 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 3 FrontBoardServices 0x2d4f40e6 0x2d4df000 + 86246 Sep 22 11:36:32 DeviceName SpringBoard[2836] <Warning>: Unable to deliver -[UIRemoteApplication showTopMostMiniAlertWithSynchronizationPort:] message to port 0: (ipc/send) invalid destination port Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 4 CoreFoundation 0x26d7a5b2 0x26cae000 + 837042 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 5 CoreFoundation 0x26d79874 0x26cae000 + 833652 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 6 CoreFoundation 0x26d77ff6 0x26cae000 + 827382 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 7 CoreFoundation 0x26cc661c 0x26cae000 + 99868 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 8 CoreFoundation 0x26cc642e 0x26cae000 + 99374 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 9 myAppName 0x00177f72 0x4f000 + 1216370 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 10 CoreFoundation 0x26db416c 0x26cae000 + 1073516 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 11 libobjc.A.dylib 0x34461f10 0x3445b000 + 28432 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 12 libc++abi.dylib 0x33d9ade0 0x33d83000 + 97760 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 13 libc++abi.dylib 0x33d9a5a4 0x33d83000 + 95652 Sep 22 11:36:32 DeviceName locationd[63] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 14 libobjc.A.dylib 0x34461d5a 0x3445b000 + 27994 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 15 CoreFoundation 0x26db3d10 0x26cae000 + 1072400 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 16 Foundation 0x27a845aa 0x279f2000 + 599466 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 17 BaseBoard 0x2b8bf8c8 0x2b89b000 + 149704 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 18 libdispatch.dylib 0x349c8b64 0x349c0000 + 35684 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 19 BaseBoard 0x2b8bf832 0x2b89b000 + 149554 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 20 UIKit 0x2a7c7ba8 0x2a242000 + 5790632 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 21 libdispatch.dylib 0x349c18c8 0x349c0000 + 6344 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 22 libdispatch.dylib 0x349c18b4 0x349c0000 + 6324 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 23 libdispatch.dylib 0x349c50ba 0x349c0000 + 20666 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 24 CoreFoundation 0x26d79be4 0x26cae000 + 834532 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 25 CoreFoundation 0x26d782e4 0x26cae000 + 828132 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 26 CoreFoundation 0x26cc661c 0x26cae000 + 99868 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 27 CoreFoundation 0x26cc642e 0x26cae000 + 99374 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 28 GraphicsServices 0x2e0740a4 0x2e06b000 + 37028 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 29 UIKit 0x2a2b0804 0x2a242000 + 452612 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 30 myAppName 0x000cee48 0x4f000 + 523848 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 31 libdyld.dylib 0x349e1aac 0x349e0000 + 6828 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 1 name: Dispatch queue: com.apple.libdispatch-manager Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 1: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libsystem_kernel.dylib 0x34a942a0 0x34a93000 + 4768 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 libdispatch.dylib 0x349cd9fc 0x349c0000 + 55804 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 libdispatch.dylib 0x349c331e 0x349c0000 + 13086 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 2 name: GAIThread Dispatch queue: NSPersistentStoreCoordinator 0x15582b60 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 2: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libsystem_kernel.dylib 0x34aa9388 0x34a93000 + 91016 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 libsqlite3.dylib 0x347e4164 0x3474b000 + 627044 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 libsqlite3.dylib 0x3479334a 0x3474b000 + 295754 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 3 libsqlite3.dylib 0x347d2544 0x3474b000 + 554308 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 4 libsqlite3.dylib 0x347d1e54 0x3474b000 + 552532 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 5 libsqlite3.dylib 0x34792f8e 0x3474b000 + 294798 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 6 libsqlite3.dylib 0x34787c72 0x3474b000 + 248946 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 7 libsqlite3.dylib 0x347657dc 0x3474b000 + 108508 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 8 libsqlite3.dylib 0x34783f10 0x3474b000 + 233232 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 9 libsqlite3.dylib 0x34778ed6 0x3474b000 + 188118 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 10 CoreData 0x26ab7ab8 0x26aa2000 + 88760 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 11 CoreData 0x26af0d92 0x26aa2000 + 322962 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 12 CoreData 0x26b87110 0x26aa2000 + 938256 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 13 CoreData 0x26b6c3ac 0x26aa2000 + 828332 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 14 CoreData 0x26b717c8 0x26aa2000 + 849864 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 15 libdispatch.dylib 0x349c18b4 0x349c0000 + 6324 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 16 libdispatch.dylib 0x349c8b64 0x349c0000 + 35684 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 17 CoreData 0x26b65302 0x26aa2000 + 799490 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 18 CoreData 0x26b6bf9a 0x26aa2000 + 827290 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 19 CoreData 0x26b3d5be 0x26aa2000 + 636350 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 20 myAppName 0x0017312c 0x4f000 + 1196332 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 21 myAppName 0x00171c46 0x4f000 + 1190982 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 22 myAppName 0x00172fe2 0x4f000 + 1196002 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 23 myAppName 0x0017d77e 0x4f000 + 1238910 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 24 myAppName 0x0017e9ee 0x4f000 + 1243630 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 25 myAppName 0x0017e7ec 0x4f000 + 1243116 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 26 Foundation 0x27ac359a 0x279f2000 + 857498 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 27 CoreFoundation 0x26d7a58c 0x26cae000 + 837004 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 28 CoreFoundation 0x26d7999a 0x26cae000 + 833946 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 29 CoreFoundation 0x26d78000 0x26cae000 + 827392 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 30 CoreFoundation 0x26cc661c 0x26cae000 + 99868 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 31 CoreFoundation 0x26cc642e 0x26cae000 + 99374 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 32 Foundation 0x279fe428 0x279f2000 + 50216 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 33 Foundation 0x27a4c8e8 0x279f2000 + 370920 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 34 myAppName 0x0016f678 0x4f000 + 1181304 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 35 Foundation 0x27ac3386 0x279f2000 + 856966 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 36 libsystem_pthread.dylib 0x34b24e90 0x34b22000 + 11920 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 37 libsystem_pthread.dylib 0x34b24e02 0x34b22000 + 11778 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 38 libsystem_pthread.dylib 0x34b22b8c 0x34b22000 + 2956 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 3: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libsystem_kernel.dylib 0x34aa7b38 0x34a93000 + 84792 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 libsystem_pthread.dylib 0x34b243f4 0x34b22000 + 9204 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 libsystem_pthread.dylib 0x34b252d8 0x34b22000 + 13016 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 3 Foundation 0x27a48f62 0x279f2000 + 356194 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 4 myAppName 0x0011f036 0x4f000 + 852022 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 5 Foundation 0x27ac3386 0x279f2000 + 856966 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 6 libsystem_pthread.dylib 0x34b24e90 0x34b22000 + 11920 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 7 libsystem_pthread.dylib 0x34b24e02 0x34b22000 + 11778 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 8 libsystem_pthread.dylib 0x34b22b8c 0x34b22000 + 2956 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 4: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libsystem_kernel.dylib 0x34aa89cc 0x34a93000 + 88524 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 libsystem_pthread.dylib 0x34b22ea8 0x34b22000 + 3752 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 libsystem_pthread.dylib 0x34b22b80 0x34b22000 + 2944 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 5 name: PF_AFNetworking Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 5: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libsystem_kernel.dylib 0x34a944f0 0x34a93000 + 5360 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 libsystem_kernel.dylib 0x34a942e4 0x34a93000 + 4836 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 CoreFoundation 0x26d79b4e 0x26cae000 + 834382 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 3 CoreFoundation 0x26d780f4 0x26cae000 + 827636 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 4 CoreFoundation 0x26cc661c 0x26cae000 + 99868 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 5 CoreFoundation 0x26cc642e 0x26cae000 + 99374 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 6 Foundation 0x279fe428 0x279f2000 + 50216 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 7 Foundation 0x27a4c8e8 0x279f2000 + 370920 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 8 myAppName 0x001317ee 0x4f000 + 927726 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 9 Foundation 0x27ac3386 0x279f2000 + 856966 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 10 libsystem_pthread.dylib 0x34b24e90 0x34b22000 + 11920 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 11 libsystem_pthread.dylib 0x34b24e02 0x34b22000 + 11778 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 12 libsystem_pthread.dylib 0x34b22b8c 0x34b22000 + 2956 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 6 name: com.apple.NSURLConnectionLoader Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 6: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libsystem_kernel.dylib 0x34a944f0 0x34a93000 + 5360 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 libsystem_kernel.dylib 0x34a942e4 0x34a93000 + 4836 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 CoreFoundation 0x26d79b4e 0x26cae000 + 834382 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 3 CoreFoundation 0x26d780f4 0x26cae000 + 827636 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 4 CoreFoundation 0x26cc661c 0x26cae000 + 99868 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 5 CoreFoundation 0x26cc642e 0x26cae000 + 99374 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 6 CFNetwork 0x2687f3da 0x26803000 + 508890 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 7 Foundation 0x27ac3386 0x279f2000 + 856966 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 8 libsystem_pthread.dylib 0x34b24e90 0x34b22000 + 11920 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 9 libsystem_pthread.dylib 0x34b24e02 0x34b22000 + 11778 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 10 libsystem_pthread.dylib 0x34b22b8c 0x34b22000 + 2956 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 7 name: com.apple.CFSocket.private Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 7: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libsystem_kernel.dylib 0x34aa808c 0x34a93000 + 86156 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 CoreFoundation 0x26d7e31a 0x26cae000 + 852762 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 libsystem_pthread.dylib 0x34b24e90 0x34b22000 + 11920 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 3 libsystem_pthread.dylib 0x34b24e02 0x34b22000 + 11778 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 4 libsystem_pthread.dylib 0x34b22b8c 0x34b22000 + 2956 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 8: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libsystem_kernel.dylib 0x34aa89cc 0x34a93000 + 88524 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 libsystem_pthread.dylib 0x34b22ea8 0x34b22000 + 3752 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 libsystem_pthread.dylib 0x34b22b80 0x34b22000 + 2944 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 9: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libsystem_kernel.dylib 0x34aa89cc 0x34a93000 + 88524 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 libsystem_pthread.dylib 0x34b22ea8 0x34b22000 + 3752 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 libsystem_pthread.dylib 0x34b22b80 0x34b22000 + 2944 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 10: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libsystem_kernel.dylib 0x34aa89cc 0x34a93000 + 88524 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 libsystem_pthread.dylib 0x34b22ea8 0x34b22000 + 3752 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 libsystem_pthread.dylib 0x34b22b80 0x34b22000 + 2944 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 11: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libsystem_kernel.dylib 0x34aa89cc 0x34a93000 + 88524 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 libsystem_pthread.dylib 0x34b22ea8 0x34b22000 + 3752 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 libsystem_pthread.dylib 0x34b22b80 0x34b22000 + 2944 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 12: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0 libsystem_kernel.dylib 0x34aa89cc 0x34a93000 + 88524 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 1 libsystem_pthread.dylib 0x34b22ea8 0x34b22000 + 3752 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 2 libsystem_pthread.dylib 0x34b22b80 0x34b22000 + 2944 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Thread 0 crashed with ARM Thread State (32-bit): Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: r0: 0x0056c500 r1: 0x00000000 r2: 0x156a7a00 r3: 0x00000fff Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: r4: 0x3713cd40 r5: 0x349de338 r6: 0x352bfca8 r7: 0x005622e8 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: r8: 0x155c4610 r9: 0x156a8000 r10: 0x155c4610 r11: 0x156cb5f0 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: ip: 0x37154124 sp: 0x005622d4 lr: 0x349c6d49 pc: 0x349c6d48 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: cpsr: 0x60000030 Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: Binary Images: Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0x4f000 - 0x2eefff myAppName armv7 <8d48834e6e563ba08bd970b675b2c2b1> /var/mobile/Containers/Bundle/Application/DE60F941-317E-49C2-95EA-0F152A117C16/myAppName.app/myAppName Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0x1fed6000 - 0x1fef9fff dyld armv7s <fd3fef9c43c9382e8e46d5d59fb52f86> /usr/lib/dyld Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0x25852000 - 0x259befff AVFoundation armv7s <291c7a621b65396491697e7a7f728b16> /System/Library/Frameworks/AVFoundation.framework/AVFoundation Sep 22 11:36:32 DeviceName ReportCrash[6766] <Error>: 0x259bf000 - 0x25a1dfff libAVFAudio.dylib armv7s <1b452a7a75513cf9aa82e59feb7eef33> /System/Library/Frameworks/AVFoundation.framework/libAVFAudio.dylib A lot of lines like the previous one 

看看这个错误信息。 在iOS SDK中,似乎断言检查失败了。

 *** Assertion failure in -[UIFetchContentInBackgroundAction sendResponse:], /SourceCache/BaseBoard/BaseBoard-97/BaseBoard/BSAction.m:221 BUG in client of libdispatch: Assertion failed: Block was run on an unexpected queue Expected queue: 0x0x3713cd40[com.apple.main-thread] 

断言没有检查指定的块是否在正确的调度队列上运行。 从断言消息和堆栈跟踪中, -[UIFetchContentInBackgroundAction sendResponse:]使用dispatch_assert_queue来检查应用程序代码是否正确使用该块的主队列。

所以你最好检查应该使用主队列的后台提取代码,但是你的代码使用全局队列,串行队列或并发队列。

在我的情况下,问题是完成处理程序后来被调用两次

有问题的代码

 -(void) application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { if(condition) { completionHandler(UIBackgroundFetchResultNoData); } completionHandler(UIBackgroundFetchResultNewData); } 

固定

 -(void) application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { if(condition) { completionHandler(UIBackgroundFetchResultNoData); } else //fix { completionHandler(UIBackgroundFetchResultNewData); } } 

请确保你没有犯这样的错误。

我有完全相同的问题描绘了坂本启之:

 2014-10-16 01:37:05.284 musiXmatch[1589:400275] *** Assertion failure in -`[UIFetchContentInBackgroundAction sendResponse:], /SourceCache/BaseBoard/BaseBoard-97/BaseBoard/BSAction.m:221` 

添加一个

 dispatch_async(dispatch_get_main_queue(), ^{ 

修正了这个问题!