说明一下:
[self scheduleDequeueReceive];

- (void)scheduleDequeueReceive方法都是
AsyncUdpSocket.m文件中的

解决方案 »

  1.   

    把-(BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port里面的代码贴出来看看再说。你那个错误是使用了已经被释放的内存。别人的库不存在这样的问题,你没改里面的代码的话,就不用把别人库里面的代码帖出来了。
      

  2.   


    -(BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port
    {
        NSLog(@"received data: %@",[[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]);
        NSLog(@"%@",host);
        if(tag==1)
        {
            if([[[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease] compare:@"ihd"])
            {
                hostIP=[[NSString alloc] initWithString:host];
                //[udpSocket close];
            }
        }
        if(tag==sn)
        {
            //先测试是否能够获取到指定的数据流
            NSLog(@"received data: %@",[[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]);
        }
        
        
        return YES;
    }
      

  3.   

    整个socket的创建及调用部分:
    self.udpSocket=[[AsyncUdpSocket alloc] initWithDelegate:self];
    [udpSocket bindToPort:8001 error:&error];    
    [udpSocket enableBroadcast:YES error:&error]; 
    [udpSocket joinMulticastGroup:@"224.0.0.1" error:&error];
    [udpSocket receiveWithTimeout:-1 tag:1];
    接收部分:
    -(BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port
    {
        NSLog(@"received data: %@",[[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]);
        NSLog(@"%@",host);
        if(tag==1)
        {
            if([[[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease] compare:@"ihd"])
            {
                hostIP=[[NSString alloc] initWithString:host];
                //[udpSocket close];
            }
        }
        if(tag==sn)
        {
            //先测试是否能够获取到指定的数据流
            NSLog(@"received data: %@",[[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]);
        }
        
        
        return YES;
    }请帮忙看看
      

  4.   

    把  [udpSocket setRunLoopModes:[NSArray arrayWithObject:NSRunLoopCommonModes]];添加到self.udpSocket=[[AsyncUdpSocket alloc] initWithDelegate:self];后面试试