我有一個程序,當設備斷開或連接時隨機發生崩潰。當我在gdb
運行bt
命令我得到如下結果:這個回溯告訴我的說明
#0 0x00007fff881cf150 in objc_msgSend_vtable5()
#1 0x00007fff8cceabf3 in -[IOBluetoothRFCOMMChannel(IOBluetoothRFCOMMChannelPrivate) processIncomingData:]()
#2 0x00007fff8cce8ee1 in -[IOBluetoothRFCOMMChannel(IOBluetoothRFCOMMChannelPrivate) handleMachMessage:]()
#3 0x00007fff8d142ba5 in __NSFireMachPort()
#4 0x00007fff8ad41e42 in __CFMachPortPerform()
#5 0x00007fff8ad41cac in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__()
#6 0x00007fff8ad419db in __CFRunLoopDoSource1()
#7 0x00007fff8ad78117 in __CFRunLoopRun()
#8 0x00007fff8ad77676 in CFRunLoopRunSpecific()
#9 0x00007fff8c88731f in RunCurrentEventLoopInMode()
#10 0x00007fff8c88e5c9 in ReceiveNextEventCommon()
#11 0x00007fff8c88e456 in BlockUntilNextEventMatchingListInMode()
#12 0x00007fff92404f5d in _DPSNextEvent()
#13 0x00007fff92404861 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]()
#14 0x00007fff9240119d in -[NSApplication run]()
#15 0x00007fff9267fb88 in NSApplicationMain()
#16 0x00000001000020d2 in main (argc=3, argv=0x7fff5fbff8e0) at main.m:13
的XCode突破上NSApplicationMain,沒有在任何地方在我的代碼,我已經告訴了所有的異常中斷。這導致我認爲這是藍牙堆棧本身發生的事情。這是正確的嗎?有什麼辦法可以防止這種情況發生,或者至少試着抓住這個來清理並防止崩潰?