iOS崩溃,原因不明

时间:2017-07-31 19:29:12

标签: ios objective-c

我正在开发一个iOS框架,一个应用程序正在崩溃。不确定问题出在哪里。基于日志,我认为一个对象正在手动释放,但随后被自动释放,再次导致崩溃。以前有人见过这样的撞车吗?不确定这是由我的框架还是使用它的应用程序引起的。

Crashed: com.apple.root.user-initiated-qos
0  libobjc.A.dylib                0xfffffffff objc_object::release() + 8
1  libobjc.A.dylib                0xfffffffff (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 724
2  CoreFoundation                 0xfffffffff _CFAutoreleasePoolPop + 28
3  libdispatch.dylib              0xfffffffff _dispatch_client_callout2 + 12
4  libdispatch.dylib              0xfffffffff _dispatch_apply_invoke_and_wait + 165
5  libdispatch.dylib              0xfffffffff dispatch_apply_f + 650
6  CoreFoundation                 0xfffffffff -[__NSSetM enumerateObjectsWithOptions:usingBlock:] + 295
7  MyFramework                    0xfffffffff MyFunction + 18550
8  MyFramework                    0xfffffffff MyFunction + 18450
9  libdispatch.dylib              0xfffffffff _dispatch_call_block_and_release + 24
10 libdispatch.dylib              0xfffffffff _dispatch_client_callout + 16
11 libdispatch.dylib              0xfffffffff _dispatch_queue_serial_drain + 928
12 libdispatch.dylib              0xfffffffff _dispatch_queue_invoke + 884
13 libdispatch.dylib              0xfffffffff _dispatch_queue_override_invoke + 344
14 libdispatch.dylib              0xfffffffff _dispatch_root_queue_drain + 540
15 libdispatch.dylib              0xfffffffff _dispatch_worker_thread3 + 124
16 libsystem_pthread.dylib        0xfffffffff _pthread_wqthread + 1096
17 libsystem_pthread.dylib        0xfffffffff start_wqthread + 4

1 个答案:

答案 0 :(得分:1)

当您在堆栈跟踪中看到_dispatch_root_queue_drain崩溃时,这意味着某个块已经在该队列上执行并且自动释放池正在耗尽

你需要检查正在释放的对象的任何内存泄漏,当在线程上执行一个块但是使用新的对象释放再次调用时发生这种崩溃,所以尝试检查以下链接它可能有助于它可能由于内存问题和对象重新发布

https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/EradicatingZombies.html