Este script simples abre os arquivos plist usados pelo simulador iOS para armazenar as NSUserDefaults
preferências.
Ele assume uma determinada configuração (se encaixa perfeitamente na minha) e deve ser colocado no mesmo diretório que o MyProject.xcworkspace
diretório.
Exemplo:
$ ls -1
MyProject
MyProject Tests
MyProject.xcodeproj
MyProject.xcworkspace
Podfile
open-prefs-plist.sh
$ cat open-prefs-plist.sh
#!/bin/sh
# The project name based on the workspace path, e.g. "MyProject" from "./MyProject.xcworkspace"
WORKSPACE_NAME=$(echo `find . -name *.xcworkspace -type d -exec basename {} ;` | cut -d'.' -f1)
SIMULATOR_PATH="$HOME/Library/Application Support/iPhone Simulator"
# The App's bundle ID taken from its info plist, e.g "com.myproject" from "./MyProject/MyProject-Info.plist"
BUNDLE_ID=`/usr/libexec/PlistBuddy -c Print:CFBundleIdentifier $WORKSPACE_NAME/$WORKSPACE_NAME"-Info.plist"`
# Open all plist files in the simulator path that match the app's bundle ID
# normally one per iOS version
find "$SIMULATOR_PATH" -name $BUNDLE_ID".plist" -type f -print0
| while IFS= read -r -d '' PLIST; do
echo $PLIST
open "$PLIST"
done