Search code examples
iosplistapp-transport-security

Getting App Transport Security problems


Hey i'm getting this error:

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

When trying to fetch an image from the web, i know this has to be with the iOS9 App Transport Security but the thing is that in my plist i have the Allow Arbitrary Loads set to true.

More then that i really can't find any more solutions for this problem.

Does anyone have any ideas?

enter image description here


Solution

  • In Exception Domains you define a security for specific domains. In this dictionary you can override what is defined with NSAllowArbitoryLoads, for example with:

    NSAppTransportSecurity
        NSAllowsArbitraryLoads = YES  
        NSExceptionDomains
            "unsecure-server-i-control.example.com"
            NSExceptionAllowsInsecureHTTPLoads = NO
    

    arbitrary loads are allowed in general, but specifically for unsecure-server-i-control.example.com they are not allowed.

    For more information see NSAppTransportSecurity in Apple docs