2

I have a problem with instagram API and iOS 9. My app works correctly on iOS 8, but not on iOS 9. I receive this error when I try to authorize a user in instagram

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

I tried a lot of variants, for example from this question App Transport Security breaks Web View

Please help me!

Community
  • 1
  • 1
Tatiana Mudryak
  • 375
  • 1
  • 3
  • 7

3 Answers3

3

Poisondmind's answer is almost correct. But there are several additions to Info.plist that are required for instagram images to load.

Once again the description of all keys can be found in ATS technotes.
Make sure you're using https: URLs.

Also note the useful debugging command:
/usr/bin/nscurl --ats-diagnostics --verbose YOUR_URL

Below is the configuration that lets my app download images from instagram:

enter image description here

Community
  • 1
  • 1
Nikita Kukushkin
  • 14,648
  • 4
  • 37
  • 45
1

Apple did this for important security reasons and eventually it will be necessary to enabled Transport Security in app updates. Using an older version disables it entirely. This fixed it for me on Xcode7:

In your Info.plist file, add instagram.com and subdomains as an exception to ATS rules like so:

<key>NSExceptionDomains</key>
    <dict>
        <key>instagram.com</key>
        <dict>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>

More info about what this is doing is documented in Apple's Transport Security technote.

poisondminds
  • 427
  • 4
  • 8
-2

This is for the ATS, if you use xcode 7 it will embeeded with ATS feature, try to build with not the version 7 like 6.1 xcode, and you can run it on ios9 devices and the calls to http will work.

  • Bad advice, it should not be the accepted answer. Xcode 6.1 is not available anymore for most of us now. – Martin Nov 17 '15 at 14:38