我在使用SocketRocket時遇到了iOS EXC_BAD_ACCESS錯誤,我不知道如何進一步調試問題以確定問題是出在我身邊還是在SocketRocket的一側。如何調試iOS上的iOS EXC_BAD_ACCESS KERN_INVALID_ADDRESS iOS
我得到的堆棧跟蹤是:
Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x2000000c
raw
0 libobjc.A.dylib objc_msgSend + 5
1 OMlearnings SRWebSocket.m line 692 __30-[SRWebSocket _failWithError:]_block_invoke_2
2 libdispatch.dylib _dispatch_call_block_and_release + 10
10 UIKit UIApplicationMain + 1136
11 OMlearnings main.m line 16 main
或有時
Crashed: NSOperationQueue Serial Queue
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0xc
raw
0 libobjc.A.dylib objc_msgSend + 5
1 OMlearnings SRWebSocket.m line 613 -[SRWebSocket scheduleInRunLoop:forMode:]
2 OMlearnings SRWebSocket.m line 600 -[SRWebSocket _connect]
3 OMlearnings OMSRealTimeTeamDashboard.m line 157 -[OMSRealTimeTeamDashboard sendMessage:]
4 OMlearnings OMSRealTimeTeamDashboard.m line 171 -[OMSRealTimeTeamDashboard eventReceived:]
5 CoreFoundation __invoking___ + 68
6 CoreFoundation -[NSInvocation invoke] + 282
7 Foundation -[NSInvocationOperation main] + 112
8 Foundation -[__NSOperationInternal _start:] + 770
14 libsystem_pthread.dylib _pthread_wqthread + 298
我的代碼庫是非常簡單的,基本上訂閱的事件,並在隊列中執行socketrocket的sendMessage(處理併發)
[signalServices subscribe:my-event toBlock:^(NSNotification * notification) {
[this.queue addOperation:[[NSInvocationOperation alloc] initWithTarget:self selector:@selector(eventReceived:) object:notification]];
}];
- (void)eventReceived: (NSNotification *)notification {
// ...
[socket send:[NSString stringWithFormat:@"%i,1,%@", currentUserId.intValue, [NSNumber numberWithInt: rate.value]]];
}
我讀過使用NSZombies調試問題的人,但是m y問題很少發生,因此在問題出現之前我可能會耗盡內存。它工作正常99%的時間。
有沒有什麼需要了解iOS可以隨機崩潰使用套接字等應用程序?例如,我們啓用了後臺獲取,這可能是一些隨機崩潰的原因嗎?
謝謝!
你解決了嗎? – Spail
那個更新? – franck