IPV6 被拒解决办法

1.1 IPV6 被拒解决办法

App需要修改三个地方:

1.manager.responseSerializer.acceptableContentTypes = nil;

2.修改AFNetworkReachabilityManager.m文件,用下面函数替换原来的这个函数。

原因:ipv6可能并没有走AF_INET6这一段代码,所以强制让代码在iOS9的版本走AF_INET6。

+ (instancetype)manager

{

double version = [[UIDevice currentDevice].systemVersion doubleValue];

if (version >= 9.0f)

{

struct sockaddr_in6 address;

bzero(&address, sizeof(address));

address.sin6_len = sizeof(address);

address.sin6_family = AF_INET6;

return [self managerForAddress:&address];

}

else

{

#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

return [self managerForAddress:&address];

}

}

1.2 AFNetwork版本在3.0以上,网络请求哪里代码这样写。

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

manager.responseSerializer.acceptableContentTypes = nil;//[NSSet setWithObject:@"text/plain"];

manager.securityPolicy = [AFSecurityPolicy defaultPolicy];

manager.securityPolicy.allowInvalidCertificates = YES;//忽略https证书

manager.securityPolicy.validatesDomainName = NO;//是否验证域名

1.3还有一种可能

** 后台压根没有配置IVP6,导致审核失败。**

你可能感兴趣的:(IPV6 被拒解决办法)