2

I get error:

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

My code:

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

Any ideas for help me?

Manuel
  • 3,828
  • 6
  • 33
  • 48
user1438709
  • 79
  • 2
  • 7

1 Answers1

3

In iOS 9 the default is to only allow https. You can opt out by adding keys to Info.plist : https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/

Stefan
  • 1,496
  • 1
  • 13
  • 26
  • Thanks Stefan so much. But still get this error. I also do by this guide: http://stackoverflow.com/questions/30739473/nsurlsession-nsurlconnection-http-load-failed-on-ios-9 Any ideas? – user1438709 Jul 23 '15 at 03:29
  • No other ideas really, sorry. You seem to use an old AFNetworking that doesn't use NSURLSession etc. Have you tried upgrading to latest AFNetworking? – Stefan Jul 23 '15 at 07:26
  • Thanks Stefan. Solved. I just upgrading to latest AFNetworking and it works. Thanks so much :) – user1438709 Jul 24 '15 at 07:43
  • which version of AFNEtworking you have upgrated? can you send me the link of it? – ios developer Aug 29 '16 at 05:53