我正在做我正在为HTTP请求做的事情:
NSString *urlStrig = [NSString stringWithFormat:@"https://mysite.com/search.json?param1=10¶m2=String¶m3=20"];
NSURL *url = [NSURL URLWithString:urlStrig];
NSOperationQueue *queue = [NSOperationQueue new];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:Timeout];
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
NSLog(@"URL:%@\nResponse: %@\nStatusCode: %i\nError: %@", url, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding], ((NSHTTPURLResponse *)response).statusCode, error);
}];
但我得到的只是每次403状态代码。通过终端中的curl进行测试工作正常。
HTTPS和NSURLConnection之间有问题吗?