Skip to content

Instantly share code, notes, and snippets.

@mlynch
Last active August 6, 2023 07:31
Show Gist options
  • Star 83 You must be signed in to star a gist
  • Fork 26 You must be signed in to fork a gist
  • Save mlynch/284699d676fe9ed0abfa to your computer and use it in GitHub Desktop.
Save mlynch/284699d676fe9ed0abfa to your computer and use it in GitHub Desktop.
Disable App Transport Security in iOS 9
<!--
This disables app transport security and allows non-HTTPS requests.
Note: it is not recommended to use non-HTTPS requests for sensitive data. A better
approach is to fix the non-secure resources. However, this patch will work in a pinch.
To apply the fix in your Ionic/Cordova app, edit the file located here:
platforms/ios/MyApp/MyApp-Info.plist
And add this XML right before the end of the file inside of the last </dict> entry:
PASTE HERE
</dict>
</plist>
-->
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
@kittykumas
Copy link

I tried all above methods with no luck. Please help!
The weirdest part is the xcode keep automatic change all the keys name by itself, I open the info. plist file side by side with xcode view. it shows different entries on the key. xcode keep omit "NS" and add "setting" in the end. Xcode version is 7.3.1
ats_xcode731

@matheusleite
Copy link

I don't have success 😢 I have tried everything but my API requests don't work on iOS.

@royken
Copy link

royken commented May 18, 2017

same issue with me, this is my code :
$http.get(my.api.com).then(function(response) { console.log("fresh", JSON.stringify(response)); }, function(error) { console.log(error); })
it returns good value on android (emulator and device), on navigators, but not on iOS. It instead return a null value as data and no error is logged

@purn3ndu
Copy link

purn3ndu commented May 19, 2017

@matheusleite and @royken. I am facing the same issue using Ionic. Did you guys find a work around?
For me the http requests work if I start a new project, but does not work for my old projects. Everything works in the old projects except for http requests. I have tried reinstalling the cordova whitelist plugin but no luck. Have been trying to solve this for a few days now. Seems like all went south after the ionic 3 upgrade. :/

@royken
Copy link

royken commented May 20, 2017

@purnendu91 i'm still on ionic 1, and still have the same issue. My api does not work on iOS 10

Cordova CLI: 6.5.0 
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
ios-deploy version: 1.9.1 
ios-sim version: 5.0.13 
OS: macOS Sierra
Xcode version: Xcode 8.2 Build version 8C38

@zubair1024
Copy link

I have tried all the methods above and still haven't been able to solve the issue.

@nourallahtq
Copy link

thanks man you help me 👍

@MrRavalB
Copy link

I have the same issue, please provide Solution...

@manuelphdev
Copy link

Same issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment