2

我得到错误:

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]];
}

有什么想法可以帮助我吗?

4

1 回答 1

3

在 iOS 9 中,默认设置是只允许 https。您可以通过向 Info.plist 添加密钥来选择退出: https ://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/

于 2015-07-22T09:05:14.500 回答