Skip to content

Instantly share code, notes, and snippets.

@yodarjun
Created October 2, 2015 14:04
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yodarjun/0a9356a87aa3502d5d3f to your computer and use it in GitHub Desktop.
Save yodarjun/0a9356a87aa3502d5d3f to your computer and use it in GitHub Desktop.
#!/bin/bash
# Put this in /hooks/after_prepare/
PLIST=platforms/ios/*/*-Info.plist
cat << EOF |
Add :NSAppTransportSecurity dict
Add :NSAppTransportSecurity:NSAllowsArbitraryLoads bool YES
Add :NSAppTransportSecurity:NSExceptionDomains:facebook.com:NSIncludesSubdomains bool YES
Add :NSAppTransportSecurity:NSExceptionDomains:facebook.com:NSThirdPartyExceptionRequiresForwardSecrecy bool NO
Add :NSAppTransportSecurity:NSExceptionDomains:fbcdn.net:NSIncludesSubdomains bool YES
Add :NSAppTransportSecurity:NSExceptionDomains:fbcdn.net:NSThirdPartyExceptionRequiresForwardSecrecy bool NO
Add :NSAppTransportSecurity:NSExceptionDomains:akamaihd.net:NSIncludesSubdomains bool YES
Add :NSAppTransportSecurity:NSExceptionDomains:akamaihd.net:NSThirdPartyExceptionRequiresForwardSecrecy bool NO
Delete :LSApplicationQueriesSchemes
Add :LSApplicationQueriesSchemes array
Add :LSApplicationQueriesSchemes:0 string 'fbapi'
Add :LSApplicationQueriesSchemes:1 string 'fbapi20130214'
Add :LSApplicationQueriesSchemes:2 string 'fbapi20130410'
Add :LSApplicationQueriesSchemes:3 string 'fbapi20130702'
Add :LSApplicationQueriesSchemes:4 string 'fbapi20131010'
Add :LSApplicationQueriesSchemes:5 string 'fbapi20131219'
Add :LSApplicationQueriesSchemes:6 string 'fbapi20140410'
Add :LSApplicationQueriesSchemes:7 string 'fbapi20140116'
Add :LSApplicationQueriesSchemes:8 string 'fbapi20150313'
Add :LSApplicationQueriesSchemes:9 string 'fbapi20150629'
Add :LSApplicationQueriesSchemes:10 string 'fbauth'
Add :LSApplicationQueriesSchemes:11 string 'fbauth2'
EOF
while read line
do
/usr/libexec/PlistBuddy -c "$line" $PLIST
done
true
@olegdater
Copy link

for some reason this gives me error when doing ionic run or build:

/hooks/after_prepare/modify_plist.sh: line 38: syntax error: unexpected end of file
Error: Hook failed with error code 2:

any idea?

@jordxn
Copy link

jordxn commented Jan 13, 2016

FYI - there's a bunch of spaces at the end of the last line, remove them and it works.

@nikhilenmudi
Copy link

Can you create a script with node that does the same modification to plist? That way windows users can also use it and it stays cross platform,

@smoyte
Copy link

smoyte commented Jul 26, 2016

This worked great for me. Amazing! Thank you!!!

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