我收到错误:
Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, NSLocalizedDescription=unsupported URL, NSUnderlyingError=0x15d275b0 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 "unsupported URL" UserInfo={NSErrorFailingURLKey=, NSErrorFailingURLStringKey=, NSLocalizedDescription=unsupported URL}}}
我的代码:
AFHTTPClient *httpClient = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:strUrl]];
[httpClient setParameterEncoding:AFFormURLParameterEncoding];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:nil parameters:info];
[request setTimeoutInterval:TIMEOUT_INTERVAL];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]initWithRequest:request];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
[self.delegate requestSuccess:[NSNumber numberWithInt:REQUEST_TYPE_LOGIN] result:[operation responseString]];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
[self.delegate requesFailed:[NSNumber numberWithInt:REQUEST_TYPE_LOGIN] result:[operation responseString]];
}
有什么想法可以帮助我吗?
答案 0 :(得分:3)
在iOS 9中,默认设置仅允许https。您可以通过向Info.plist添加密钥来选择退出: https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/