如何在iOS上调试iOS EXC_BAD_ACCESS KERN_INVALID_ADDRESS

 周周周周芮多 发布于 2023-02-09 12:55

我在使用SocketRocket时遇到iOS EXC_BAD_ACCESS错误,我想知道我可以做些什么来进一步调试问题,以确定问题是在我身边,还是在SocketRocket方面.

我得到的堆栈跟踪是:

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调试问题的人,但我的问题很少发生,所以在问题变得可见之前我可能会耗尽内存.它在99%的时间内都能正常工作.

有没有什么可以知道的iOS可以随机崩溃使用套接字的应用程序等?例如,我们启用了后台提取,这可能是一些随机崩溃的原因吗?

谢谢 !

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有