AsyncSocket release模式崩溃

事情的经过是这样的,上传新项目审核, 结果被拒,提示是

2. 1 PERFORMANCE: APP COMPLETENESS
Performance - 2.1


Your app crashes on iPhone running iOS 10.0.1 connected to an IPv6 network when we tap the log-in button after filling in the demo account information.

This occurred when your app was used:
- On Wi-Fi

We have attached detailed crash logs to help troubleshoot this issue.

Next Steps

Please revise your app and test it on a device while connected to an IPv6 network (all apps must support IPv6) to ensure that it runs as expected.

意思就是:你的APP在 IPV6 网络状态、iOS10.0.1 崩溃了。

我原来是适配了ipv6的,我就定位到是因为iOS 10 的问题,然后在iOS 10 debug模式运行没问题, 重新上传还是被拒,最后在release模式终于 找到崩溃信息。


AsyncSocket release模式崩溃_第1张图片
屏幕快照 2016-09-21 下午12.00.53.png

纠结了好久最后 看到也有人遇到过这种问题
解决办法:

/** 
 * This is the callback we setup for CFReadStream. 
 * This method does nothing but forward the call to it's Objective-C counterpart 
**/  
static void MyCFReadStreamCallback (CFReadStreamRef stream, CFStreamEventType type, voidvoid *pInfo)  
{  
    @autoreleasepool {  
      
        AsyncSocket *theSocket = (__bridge AsyncSocket *)pInfo;  
        [theSocket doCFReadStreamCallback:type forStream:stream];  
      
    }  
}  
  
/** 
 * This is the callback we setup for CFWriteStream. 
 * This method does nothing but forward the call to it's Objective-C counterpart 
**/  
static void MyCFWriteStreamCallback (CFWriteStreamRef stream, CFStreamEventType type, voidvoid *pInfo)  
{  
    @autoreleasepool {  
      
        AsyncSocket *theSocket = (__bridge AsyncSocket *)pInfo;  
        [theSocket doCFWriteStreamCallback:type forStream:stream];  
      
    }  
}  

修改后:

/**
 * This is the callback we setup for CFReadStream.
 * This method does nothing but forward the call to it's Objective-C counterpart
**/
static void MyCFReadStreamCallback (CFReadStreamRef stream, CFStreamEventType type, void *pInfo)
{
    @autoreleasepool {
        AsyncSocket *theSocket =[[AsyncSocket alloc]init];
        theSocket = (__bridge AsyncSocket *)pInfo;
        [theSocket doCFReadStreamCallback:type forStream:stream];
    
    }
}

/**
 * This is the callback we setup for CFWriteStream.
 * This method does nothing but forward the call to it's Objective-C counterpart
**/
static void MyCFWriteStreamCallback (CFWriteStreamRef stream, CFStreamEventType type, void *pInfo)
{
    @autoreleasepool {
        AsyncSocket *theSocket =[[AsyncSocket alloc]init];
        theSocket = (__bridge AsyncSocket *)pInfo;
        [theSocket doCFWriteStreamCallback:type forStream:stream];
    
    }
} 

参考 http://blog.csdn.net/small_tgs/article/details/50826454

你可能感兴趣的:(AsyncSocket release模式崩溃)