Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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>