스크립트는 ios-sim
명령의 래퍼이며 명령 줄에서 직접 사용할 수 있습니다. 거기에 에뮬레이트 스크립트로 하나가 현재 작업 디렉토리를한다 가정하면, 다음과 아이 패드 모드에서 에뮬레이터에서 빌드를 실행할 수 있습니다 :
ios-sim launch ../build/myApp.app --family ipad --stderr console.log --stdout console.log &
을 다음은 의심 할 여지없이 순진하다 (나는 쉘 - 모르는 스크립팅), 나는 emulate
스크립트를 해킹하여 장치 패밀리를 지정할 수있는 두 번째 명령 줄 매개 변수를 지원합니다. 스크립트가 이미 매개 변수가 지정되지 않은 경우 경로를 계산할 때 프로젝트의 .app
파일에 대한 경로를 지정할 수있는 첫 번째 매개 변수를 이미 허용한다는 사실을 모를 수도 있습니다.
업데이트는 다음 (GitHub의 포크 here)으로 스크립트의 버전 :
#! /bin/sh
#
# Licensing info removed for brevity
#
set -e
XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
XCODE_MIN_VERSION="4.5"
if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
exit 1
fi
CORDOVA_PATH=$(cd "$(dirname "$0")" && pwd -P)
PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
XCODEPROJ=$(ls "$PROJECT_PATH" | grep .xcodeproj )
PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
APP_PATH=$1
DEVICE_FAMILY=$2
if [ $# -lt 1 ]; then
APP_PATH="$PROJECT_PATH/build/$PROJECT_NAME.app"
DEVICE_FAMILY=iphone
fi
if [ ! -d "$APP_PATH" ]; then
echo "Project '$APP_PATH' is not built. Building."
$CORDOVA_PATH/build || exit $?
fi
if [ ! -d "$APP_PATH" ]; then
echo "$APP_PATH not found to emulate."
exit 1
fi
# launch using ios-sim
if which ios-sim >/dev/null; then
ios-sim launch "$APP_PATH" --family "$DEVICE_FAMILY" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" &
else
echo -e '\033[31mError: ios-sim was not found. Please download, build and install version 1.4 or greater from https://github.com/phonegap/ios-sim into your path. Or "brew install ios-sim" using homebrew: http://mxcl.github.com/homebrew/\033[m'; exit 1;
fi
당신은 다음과 같이 스크립트를 실행할 수는 (현재의 작업 디렉토리가 스크립트를 포함하고있는 코르도바 디렉토리입니다 가정) :
항상 iPad에서 테스트 할 때마다 앱의 경로를 지정할 필요가없는 경우 선호하는 기기 제품군을 스크립트에 하드 코딩하고 에뮬레이터를 시작하면됩니다. y로서 OU 이전하고있다 :
ios-sim launch "$APP_PATH" --family ipad --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" &
http://docs.phonegap.com/en/2.2.0/guide_command-line_index.md.html # Command-Line % 20Usage_ios – F481
고마워, F481,하지만 내 질문에 그 URL에 연결되어 있습니다. 에뮬레이터를 아이 패드로 시작하는 법을 말하지 않는다. –