TUESDAY – Wow. I learned an important stuff today. Stuff about AFNetworking. Okay, so recently I updated my Xcode from 6 to 7. My CTO required me to do so, he told me to update because some of his codes in my main project couldn't be understood by the old Xcode. I don't know, but he was talking about the LLVM compiler in Xcode.
So by updating to Xcode 7, it means that my iOS SDK was upgraded as well. Therefore we are now targeting the iOS 9 for our project, and with that being said, the security stuff in networking side of our project was changed. I mean I think the iOS 9 greatly improved the security of the iOS in networking.
I was getting an error in AFNetworking, it says:
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
I spent 1 to 2 hours to solve this stubborn error. You need to edit your info.plist file, and put this code below:
BE SURE TO EDIT THE HOST/SERVER ADDRESS, okay? I'm like adding Facebook server to the list of my exception here, so that the app can connect to Facebook.
NSAppTransportSecurity NSAllowsArbitraryLoads NSExceptionDomains YOUR-IP-SERVER/key> NSExceptionAllowsInsecureHTTPLoads NSIncludesSubdomains NSThirdPartyExceptionRequiresForwardSecrecy akamaihd.net NSIncludesSubdomains NSThirdPartyExceptionRequiresForwardSecrecy facebook.com NSIncludesSubdomains NSThirdPartyExceptionRequiresForwardSecrecy fbcdn.net NSIncludesSubdomains NSThirdPartyExceptionRequiresForwardSecrecy
If you find this helpful, then please share and subscribe ;)