AFN2.6上线审核适配ipv6网络访问

转自:http://blog.csdn.net/shan1991fei/article/details/52150961

切图:

AFN2.6上线审核适配ipv6网络访问_第1张图片

修改pods文件:

+ (instancetype)sharedManager {

staticAFNetworkReachabilityManager*_sharedManager =nil;

staticdispatch_once_t onceToken;

dispatch_once(&onceToken, ^{

structsockaddr_in address;

bzero(&address,sizeof(address));

address.sin_len=sizeof(address);

address.sin_family= AF_INET;

_sharedManager = [selfmanagerForAddress:&address];

});

return_sharedManager;

}



修改为:

+ (instancetype)sharedManager {

staticAFNetworkReachabilityManager*_sharedManager =nil;

staticdispatch_once_t onceToken;

dispatch_once(&onceToken, ^{

_sharedManager = [selfmanager];

});

return_sharedManager;

}

+ (instancetype)manager

{

#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)

structsockaddr_in6address;

bzero(&address,sizeof(address));

address.sin6_len=sizeof(address);

address.sin6_family= AF_INET6;

#else

structsockaddr_in address;

bzero(&address,sizeof(address));

address.sin_len=sizeof(address);

address.sin_family= AF_INET;

#endif

return[selfmanagerForAddress:&address];

}

你可能感兴趣的:(AFN2.6上线审核适配ipv6网络访问)