Posts

Post not yet marked as solved
1 Replies
881 Views
xcode version:12.2 I was using NSURLSessionConfiguration @property connectionProxyDictionary on iOS 14. When creating a https proxy server, I found that the https request response was 403 and Error Domain=kCFErrorDomainCFNetwork Code=310 。what should I do? this is my demo code: NSDictionary *proxyConfig = @{       @"HTTPSEnable" : @(1),       @"HTTPSProxy"  : EmailProxyIP,       @"HTTPSPort"   : @(443)};     NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];     sessionConfig.connectionProxyDictionary = proxyConfig;     sessionConfig.HTTPShouldSetCookies = YES;     sessionConfig.HTTPMaximumConnectionsPerHost = 1;     sessionConfig.HTTPCookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];   NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];   NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www..com"];   NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:                  ^(NSData *data, NSURLResponse *response, NSError *error) {                                       if (error) {                    NSLog(@"Failed === Response:%@ %@\n", response, error);                    }                    NSString* newStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];                    NSLog(@"%@",newStr);                  }];   [task resume];
Posted
by joe2017.
Last updated
.