https

“The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.”

I started getting this error when making network requests to our dev server after upgrading and testing our app using Xcode 7 and iOS 9.

It turns out that this is a feature introduced in iOS 9, App Transport Security. It basically requires the app to make requests to https urls. These also should be specified in the info.plist.

It is possible to switch this off and at the time of writing this post that was the easiest course of action.

<key>NSAppTransportSecurity</key>
<dict>
  <!--Include to allow all connections (DANGER)-->
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>

** This is not the advised way to deal with this error **

Have a look at Steven Peterson’s blog post going into a lot more detail about how to configure your app for App Transport Security

Git pull and push asks for username and password every time

I recently rebuilt my computer and cloned a git repository that I had been working on. Once I started working on the project again, I realised that every time I was executing a pull or push command in git bash it would ask me for my username and password whereas before it used to only request by password.

I checked my .gitconfig and it contained the correct details (under [user] i had name and email). I double checked that a second .gitconfig hadn’t been created elsewhere that was causing a conflict.

I eventually found out that it was because I had cloned the repository using the https url instead of the ssh. I just had to change the way I was connecting the remote repository, and that was done using the command below. Once I had done this my push and pull commands no longer asked for my username.

git remote set-url origin git@github.com:username/repo.git
 Scroll to top