diff --git a/bin/run_ios_app b/bin/run_ios_app index 0738772..8d58c11 100755 --- a/bin/run_ios_app +++ b/bin/run_ios_app @@ -1,11 +1,26 @@ #!/usr/bin/env sh +tmpdir="$(mktemp -dt "$(basename "$0")")" +trap "rm -rf $tmpdir" EXIT + build_path=$(xcodebuild -showBuildSettings "$@" 2>/dev/null | egrep "\bBUILD_DIR\b" | sed -E "s/[[:space:]]+BUILD_DIR = //") app_path=$(find "$build_path" -iname "*.app" | head -n1) app_id=$(defaults read "$app_path/Info" "CFBundleIdentifier") +executable_name=$(defaults read "$app_path/Info" "CFBundleExecutable") +executable_path="$app_path/$executable_name" +lldb_script_path="$tmpdir/launch_ios_app.lldb" uuid=$(xcrun simctl list devices | grep "$SIMULATOR" | head -n1 | grep -E "[0-9A-F-]{8,}" -o) xcrun instruments -w "$uuid" 2>/dev/null xcrun simctl install booted "$app_path" -xcrun simctl launch booted "$app_id" + +cat >"$lldb_script_path" <