如何在Swift中找到EXC_BAD_ACCESS的源代码

时间:2014-11-17 17:11:33

标签: ios swift exc-bad-access lldb

我在模拟器中运行我的应用程序,在与屏幕进行一些交互后,我收到了EXC_BAD_ACCESS错误。

bt显示以下内容:

* thread #1: tid = 0x64a4, 0x021a80be libobjc.A.dylib`objc_msgSend + 26, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xeea812b8)
    frame #0: 0x021a80be libobjc.A.dylib`objc_msgSend + 26
    frame #1: 0x002b7c37 CoreFoundation`CFRelease + 743
    frame #2: 0x00792c3b CoreGraphics`data_provider_finalize + 51
    frame #3: 0x002b7bdc CoreFoundation`CFRelease + 652
    frame #4: 0x0086a504 CoreGraphics`image_finalize + 96
    frame #5: 0x002b7bdc CoreFoundation`CFRelease + 652
    frame #6: 0x049822a0 QuartzCore`CA::release_objects(X::List<void const*>*) + 20
    frame #7: 0x0498230e QuartzCore`CA::Transaction::unlock() + 54
    frame #8: 0x04a2097a QuartzCore`CA::Layer::free_transaction(CA::Transaction*) + 168
    frame #9: 0x04982825 QuartzCore`CA::Transaction::commit() + 545
    frame #10: 0x04982e58 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
    frame #11: 0x0031a9de CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    frame #12: 0x0031a920 CoreFoundation`__CFRunLoopDoObservers + 400
    frame #13: 0x0031035a CoreFoundation`__CFRunLoopRun + 1226
    frame #14: 0x0030fbcb CoreFoundation`CFRunLoopRunSpecific + 443
    frame #15: 0x0030f9fb CoreFoundation`CFRunLoopRunInMode + 123
    frame #16: 0x0455d24f GraphicsServices`GSEventRunModal + 192
    frame #17: 0x0455d08c GraphicsServices`GSEventRun + 104
    frame #18: 0x00fcb8b6 UIKit`UIApplicationMain + 1526
  * frame #19: 0x001006cf APPNAME`main [inlined] top_level_code + 76 at AppDelegate.swift:12
    frame #20: 0x00100683 APPNAME`main + 35 at AppDelegate.swift:0
    frame #21: 0x02912ac9 libdyld.dylib`start + 1

如果我要求f 19,我会得到以下内容,这不是很有帮助:

frame #19: 0x001006cf APPNAME`main [inlined] top_level_code + 76 at AppDelegate.swift:12
   9    import UIKit
   10   
   11   @UIApplicationMain
-> 12   class AppDelegate: UIResponder, UIApplicationDelegate {
   13   
   14       var window: UIWindow?
   15

以不同的方式使用我的屏幕,现在我得到了以下bt

* thread #6: tid = 0x7d08, 0x021f65ef libobjc.A.dylib`_objc_trap() + 3, queue = 'com.apple.root.default-qos', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x021f65ef libobjc.A.dylib`_objc_trap() + 3
    frame #1: 0x021f6676 libobjc.A.dylib`_objc_fatal + 99
    frame #2: 0x0220cc74 libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::busted(bool) + 152
    frame #3: 0x0220ba9f libobjc.A.dylib`objc_autoreleasePoolPush + 43
    frame #4: 0x02930f53 libdispatch.dylib`_dispatch_root_queue_drain + 190
    frame #5: 0x0293284a libdispatch.dylib`_dispatch_worker_thread3 + 115
    frame #6: 0x02ca4296 libsystem_pthread.dylib`_pthread_wqthread + 724
    frame #7: 0x02ca1eea libsystem_pthread.dylib`start_wqthread + 30

我已尝试清理我的项目,正如另一个问题所示,错误仍然存​​在。我是iOS编程的新手,也是lldb的新手,并且不知道接下来要去哪里看。

0 个答案:

没有答案