我从Crashlytics收到了一张崩溃的日志。
崩溃:com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000000000000000c
WSConnect.m第270行 - [WSConnect webSocket:didReceiveMessage:]
这是代码导致崩溃:
- (void)webSocket:(SRWebSocket *)_webSocket didReceiveMessage:(id)message{
NSData *data = [message dataUsingEncoding:NSUTF8StringEncoding];
NSError* error;
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data
options:kNilOptions
error:&error];
MutableOrderedDictionary* dictResponse = [MutableOrderedDictionary dictionaryWithDictionary:dict];
NSString* hId = [NSString stringWithFormat:@"h%@",mID];
if ([dictRequest objectForKey:hId]) {
WSPacket* packet = [dictRequest objectForKey:hId];
@synchronized(@"RemoveLock") {
[dictRequest removeObjectForKey:hId];
@synchronized(@"LOCK_PROCESS") {
packet.handler(dictResponse); // This line made crashed
}
packet.handler = nil;
packet.data = nil;
packet.mID = nil;
packet = nil;
}
return;
}
谁能告诉我为什么?感谢您阅读我的问题!