Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 1.69 KB

2015-09-11-http-in-ios-9.md

File metadata and controls

32 lines (24 loc) · 1.69 KB
layout title date summary categories
post
HTTP in iOS development
2015-09-11
HTTP vs HTTPS in iOS 9.
jekyll pixyll

Yesterday, I have had a problem to download a data(picture) from a web page. Despite, I was pretty sure that each line of code I have wrote was correct, I cannot prevent myself to see the default image all my tableview on the application that I developed. App doesn’t load picture from URLs, it just show the picture in its assets folder. The code just have some warning, and that’s all. After many times I checked whether the URLs that I borrowed pictures are active, and built the application for couple of times, I realised that on Xcode, “Application 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.” warning appears.

Application 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.

Swift Compiler

Apparently, apple doesn’t want your app to talk with the insecure HTTP instead of secure HTTPS. For that reason, it sets default not to talk with HTTP, but you have the power to change it!

And after some search, I found the solution.

Adding the following to your Info.plist will disable Application Transport Security and let the application to talk with the HTTP.

{% highlight swift %} NSAppTransportSecurity

NSAllowsArbitraryLoads

{% endhighlight %}

Happy coding!