我正在使用 GCDacyncUDPSocket 接收数据。在下面的代码中,我正在创建一个 (timestamp, data) 元组并将其添加到另一个数组中。这是我的代码:
- (void)udpSocket:(GCDAsyncUdpSocket *)sock didReceiveData:(NSData *)data fromAddress:(NSData *)address withFilterContext:(id)filterContext
{
dispatch_queue_t bg_queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
NSString *msg = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSTimeInterval t = [self getTime];
if (msg)
{
[self.activityQueue.activityQueue enqueue:@"1"];
dispatch_async(bg_queue, ^{
NSData * d = [data copy];
[self addRecvJitter:t withData:d];
d= nil;
});
}
}
- (void)addRecvJitter:(NSTimeInterval)t withData:(NSData *)data
{
NSString * add = [NSString stringWithFormat:@"%f",( t - self.jitterOrigin)];
NSArray * addToList = [[NSArray alloc] initWithObjects:add,data, nil];
[_rcvdJitter addObject:addToList];
}
我收到以下错误 malloc:* 对象 0x7a9c2820 的错误:double free *在 malloc_error_break 中设置断点以在此行进行调试“[_rcvdJitter addObject:addToList];”
我能得到一些帮助吗?
谢谢