Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Blog Reader iPhone App Getting Data from the Web Downloading and Parsing JSON Data

Riken Patel
Riken Patel
659 Points

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions

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.

Terminating app due to uncaught exception 'NSInvalidArgumentException',

reason: 'data parameter is nil'

1 Answer

Christin Lepson
Christin Lepson
24,269 Points

The reason this is happening is because xCode wants you to work with secure websites (https://) and TeamTreehouse's json URL is not secure (http://)

To do this we must make an exceptions by editing the info.plist file in your project.

Right click your info.plist file and click "Open With External Editor." This will open your info.plist file in a text editor. If you don't have a text editor I reccomens SublimeText or TextMate.

Next, paste the following code before the </dict>

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>yourserver.com</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <!--Include to specify minimum TLS version-->
      <key>NSTemporaryExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>