randomGuy
randomGuy

Reputation: 63

Cordova ios app can't load device data

I searched a lot about my issue and I tried different solution, but it doesn't work :/

Link what I tried: NSURLSession/NSURLConnection HTTP load failed on iOS 9

2016-06-24 10:51:56.760 <App Name>[1817:1004680] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)

UPDATE

After adding the lines below:

<key>NSAppTransportSecurity</key>
 <dict>
   <key>NSAllowsArbitraryLoads</key>
   <true/>
 </dict>

I get this error:

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)

But when I follow the introduction of developer apple everything should be fine:

nscurl --ats-diagnostics --verbose result

Upvotes: 3

Views: 3925

Answers (1)

randomGuy
randomGuy

Reputation: 63

I figured it out. I had to add the following lines in Classes/AppDelegate.m above the @implementation AppDelegate:

@implementation NSURLRequest(DataController)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host{
  return YES;
}
@end

What I'm using:

  • cordova version 5.3.3
  • platform: iio 4.2.0

helpful link: NSURLConnection/CFURLConnection HTTP load failed ionic

Upvotes: 2

Related Questions