AFNetworking 添加支持 IPv6 的网络请求协议

AFNetworking/AFNetworkReachabilityManager.h 

第一步  找到   @param address The socket address (`sockaddr_in`) used to evaluate network reachability.    这句话

 修改:  (`sockaddr_in`) ------>  (`sockaddr_in6`)

第二步: 找到 + (instancetype)sharedManager  这个方法

由    struct sockaddr_in address;

bzero(&address, sizeof(address));

address.sin_len = sizeof(address);

address.sin_family = AF_INET;       这几句修改成:

#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)

struct sockaddr_in6 address;

bzero(&address, sizeof(address));

address.sin6_len = sizeof(address);

address.sin6_family = AF_INET6;

#else

struct sockaddr_in address;

bzero(&address, sizeof(address));

address.sin_len = sizeof(address);

address.sin_family = AF_INET;

#endif

你可能感兴趣的:(AFNetworking 添加支持 IPv6 的网络请求协议)