3

I'm trying to write a Swift app that pulls the RSS feed from a blog and displays it onto the screen. There's an 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.

How do I configure the one blog's website Info.plist to be an exception? There is no NSAllowsArbitraryLoads option in the drop-down menu.

Mimi
  • 51
  • 1
  • 1
  • 2
  • http://stackoverflow.com/questions/31216758/how-can-i-add-nsapptransportsecurity-to-my-info-plist-file this is the answer. – caldera.sac Feb 28 '17 at 04:13
  • I tried editing the text file using the exact method that you linked, and it didn't work. The XCode editor didn't have a NSAllowsArbitraryLoads option at all. – Mimi Feb 28 '17 at 04:33
  • go to your `info.plist`, then click on `+` icon and just type `NSAppTransportSecurity` and hit enter. it this will change it to `App Transport Security Settings` – caldera.sac Feb 28 '17 at 05:07
  • I have NSAppTransportSecurity, but not NSAllowsArbitraryLoads. – Mimi Feb 28 '17 at 14:19

1 Answers1

14

Add to your Info.plist file:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
javimuu
  • 1,829
  • 1
  • 18
  • 29
  • This is definitely not the preferred way to do this. It is better to add exceptions for the domain in question if it is out of your control. – Alper Jun 19 '18 at 13:04
  • @Alper It depends on the case what you are trying to resolve. For example, if you want to test in localhost, you should add this config to your info.plist rather try to add an exception in the code to check the domain. – javimuu Jul 12 '19 at 07:10