NSKeyValuePushPendingNotificationPerThread中的EXC_BAD_ACCESS

时间:2014-12-17 00:30:48

标签: ios objective-c foundation

我在一些KVO相关代码中遇到了一个非常奇怪的崩溃。我的应用程序在NSKeyValuePushPendingNotificationPerThread()中崩溃。

我有一个NSURLSessionDataTask嵌入在NSOperation子类中,我使用KVO观察任务的state属性,以便更新我的NSOperation的状态(在任务完成时将其设置为完成)。 / p>

我可能无法轻易地重现这一点,因为它只是在非常罕见的情况下随机发生(这是我第三次在调试器中捕获它)。如果有人已经遇到过类似的事情,我仍然想了解发生了什么。 我不明白(通过堆栈跟踪判断),我的代码是如何负责这样的。

这是堆栈跟踪(我附加2个屏幕截图):

Thread 24Queue : com.apple.NSURLSession-work (serial)
#0  0x38886626 in objc_msgSend ()
#1  0x2ea28c3e in NSKeyValuePushPendingNotificationPerThread ()
#2  0x2ea16e86 in NSKeyValueWillChange ()
#3  0x2ea03a28 in -[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] ()
#4  0x2ea601c0 in _NSSetIntValueAndNotify ()
#5  0x2dcfa630 in -[__NSCFLocalSessionTask _task_onqueue_didFinish] ()
#6  0x2dd56a24 in __59-[__NSCFLocalSessionBridge task:didFinishLoadingWithError:]_block_invoke ()
#7  0x2dd56770 in -[__NSCFLocalSessionBridge task:didFinishLoadingWithError:] ()
#8  0x2dd54e68 in __64-[__NSCFLocalSessionBridge initWithConfiguration:session:queue:]_block_invoke ()
#9  0x2dd72f24 in ___ZNK24ClassicConnectionSession28_connection_didFinishLoadingEP16_CFURLConnection_block_invoke ()
#10 0x38d65d52 in _dispatch_call_block_and_release ()
#11 0x38d6acbc in _dispatch_queue_drain ()
#12 0x38d67c6e in _dispatch_queue_invoke ()
#13 0x38d6b5f0 in _dispatch_root_queue_drain ()
#14 0x38d6b8dc in _dispatch_worker_thread2 ()
#15 0x38e96c16 in _pthread_wqthread ()
#16 0x38e96adc in start_wqthread ()

enter image description here enter image description here

0 个答案:

没有答案