AFHTTPSessionManager*session = [AFHTTPSessionManagermanager];
//session.securityPolicy.allowInvalidCertificates = YES; // not recommended for production
//session.responseSerializer = [AFJSONResponseSerializer serializer];
//session.requestSerializer = [AFJSONRequestSerializer serializer];
//允许非权威机构颁发的证书
session.securityPolicy.allowInvalidCertificates=YES;
//也不验证域名一致性
session.securityPolicy.validatesDomainName=NO;
//关闭缓存避免干扰测试
session.requestSerializer.cachePolicy=NSURLRequestReloadIgnoringLocalCacheData;
[sessionPOST:@"https://139.196.180.54/"parameters:dicprogress:^(NSProgress*_NonnulluploadProgress) {
}success:^(NSURLSessionDataTask*_Nonnulltask,id_NullableresponseObject) {
NSLog(@"sucess = %@",responseObject);
}failure:^(NSURLSessionDataTask*_Nullabletask,NSError*_Nonnullerror) {
NSLog(@"error = %@",error);
}];
网友评论