Skip to content

Instantly share code, notes, and snippets.

@starhoshi
Last active January 4, 2016 06:12
Show Gist options
  • Save starhoshi/daeddcf097a47e490904 to your computer and use it in GitHub Desktop.
Save starhoshi/daeddcf097a47e490904 to your computer and use it in GitHub Desktop.
cordova ios9 App Transport Security (project_root/after_prepare/ios9-transport-security.sh)
#!/bin/bash
PLIST=platforms/ios/*/*-Info.plist
cat << EOF |
Add :NSAppTransportSecurity dict
Add :NSAppTransportSecurity:NSExceptionDomains dict
Add :NSAppTransportSecurity:NSExceptionDomains:dev.example.com dict
Add :NSAppTransportSecurity:NSExceptionDomains:dev.example.com:NSExceptionAllowsInsecureHTTPLoads bool YES
Add :NSAppTransportSecurity:NSExceptionDomains:dev.example.com:NSExceptionRequiresForwardSecrecy bool NO
Add :NSAppTransportSecurity:NSExceptionDomains:dev.example.com:NSExceptionMinimumTLSVersion string TLSv1.0
Add :NSAppTransportSecurity:NSExceptionDomains:production.example.com dict
Add :NSAppTransportSecurity:NSExceptionDomains:production.example.com:NSExceptionAllowsInsecureHTTPLoads bool YES
Add :NSAppTransportSecurity:NSExceptionDomains:production.example.com:NSExceptionRequiresForwardSecrecy bool NO
Add :NSAppTransportSecurity:NSExceptionDomains:production.example.com:NSExceptionMinimumTLSVersion string TLSv1.0
EOF
while read line
do
/usr/libexec/PlistBuddy -c "$line" $PLIST
done
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment