Skip to content

Instantly share code, notes, and snippets.

@DylanLacey
Last active February 12, 2016 09:30
Show Gist options
  • Save DylanLacey/394fdc00be0e74b09724 to your computer and use it in GitHub Desktop.
Save DylanLacey/394fdc00be0e74b09724 to your computer and use it in GitHub Desktop.
Enable All Cookies for iOS 7.0
#!/bin/bash
# This works for iOS 8 Simulator; For 7 and 6 use prerun.sh
plist_command="Set NSHTTPAcceptCookies always"
echo "Running $plist_command against:"
for d in ~/Library/Developer/CoreSimulator/Devices/*/ ; do
web_plist=$d"data/Library/Preferences/com.apple.WebFoundation.plist"
echo " $web_plist"
/usr/libexec/PlistBuddy -c "$plist_command" $web_plist
done
#! /bin/bash
# Wait until the simulator is running before we try to add the file
simulator=$(ps aux | grep launchd_sim | grep -v grep)
while [ -z "$simulator" ]
do
echo Sleeping for 5
sleep 5
simulator=$(ps aux | grep launchd_sim | grep -v grep)
done
# Parse out the simulator in use
device=$(echo $simulator | sed -n 's_^.*/Users/.*/CoreSimulator/Devices/\([0-9A-Z-]*\).*_\1_p')
# Edit the plist
plist_command="Set NSHTTPAcceptCookies always"
sim="/Users/chef/Library/Developer/CoreSimulator/Devices/"$d
web_plist=$sim"data/Library/Preferences/com.apple.WebFoundation.plist"
echo "Editing plist $web_plist"
/usr/libexec/PlistBuddy -c "$plist_command" $web_plist
#! /bin/bash
echo "Contents of iPhone SimulatorDirectory"
ls ~/Library/Application\ Support/iPhone\ Simulator
echo "Contents of iPhone SimulatorDirectory 7.0"
ls ~/Library/Application\ Support/iPhone\ Simulator/7.0.3
echo "Contents of iPhone Simulator Directory Prefs"
ls ~/Library/Application\ Support/iPhone\ Simulator/7.0.3-64/Library/Preferences
echo "About to edit the Plists"
/usr/libexec/PlistBuddy -c "Print NSHTTPAcceptCookies" ~/Library/Application\ Support/iPhone\ Simulator/7.0.3-64/Library/Preferences/com.apple.WebFoundation.plist
/usr/libexec/PlistBuddy -c "Print NSHTTPAcceptCookies" ~/Library/Application\ Support/iPhone\ Simulator/7.0.3/Library/Preferences/com.apple.WebFoundation.plist
/usr/libexec/PlistBuddy -c "Set NSHTTPAcceptCookies always" ~/Library/Application\ Support/iPhone\ Simulator/7.0.3-64/Library/Preferences/com.apple.WebFoundation.plist
/usr/libexec/PlistBuddy -c "Set NSHTTPAcceptCookies always" ~/Library/Application\ Support/iPhone\ Simulator/7.0.3/Library/Preferences/com.apple.WebFoundation.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment