使用 xcodebuild 在模拟器上构建和 运行 一个应用程序
Build and run an app on simulator using xcodebuild
我有以下目标要实现:使用 xcodebuild
和 ios-sim
.
构建和 运行 一个 .app
应用程序
我正在使用以下脚本来构建应用程序。
xcrun xcodebuild \
-scheme $XCODE_SCHEME \
-project $XCODE_PROJECT \
-configuration Debug \
-destination generic/platform=iOS \
-derivedDataPath \
build
然后运行宁它,我使用
ios-sim launch MyApp.app/ --devicetypeid "iPhone-6-Plus, 9.1"
每次我收到以下信息:
Program specified by service does not contain one of the requested
architectures: ?
发生了什么,应用程序没有 运行?
注意:如果我运行第二个命令(ios-sim...
)反对从Xcode构建的.app
(一个包含在派生数据中)程序工作正常。
好的。解决了问题。
您需要指定正确的 destination
。例如。
xcrun xcodebuild \
-scheme $XCODE_SCHEME \
-project $XCODE_PROJECT \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 6 Plus,OS=9.1' \
-derivedDataPath \
build
这样 Xcode 将创建包含您的产品的文件夹(称为 build
)(具体请查看 Debug-iphonesimulator
)。 build
目录是在您 运行 使用 xcodebuild
命令的目录中创建的。
现在您可以指向该文件夹以便 运行 ios-sim
命令(有关详细信息,请参阅 ios-sim for more references) or simctl
(see iOS 8: Building custom simulators and Build And Run iOS Apps In Commmand Line)。
我有以下目标要实现:使用 xcodebuild
和 ios-sim
.
.app
应用程序
我正在使用以下脚本来构建应用程序。
xcrun xcodebuild \
-scheme $XCODE_SCHEME \
-project $XCODE_PROJECT \
-configuration Debug \
-destination generic/platform=iOS \
-derivedDataPath \
build
然后运行宁它,我使用
ios-sim launch MyApp.app/ --devicetypeid "iPhone-6-Plus, 9.1"
每次我收到以下信息:
Program specified by service does not contain one of the requested architectures: ?
发生了什么,应用程序没有 运行?
注意:如果我运行第二个命令(ios-sim...
)反对从Xcode构建的.app
(一个包含在派生数据中)程序工作正常。
好的。解决了问题。
您需要指定正确的 destination
。例如。
xcrun xcodebuild \
-scheme $XCODE_SCHEME \
-project $XCODE_PROJECT \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 6 Plus,OS=9.1' \
-derivedDataPath \
build
这样 Xcode 将创建包含您的产品的文件夹(称为 build
)(具体请查看 Debug-iphonesimulator
)。 build
目录是在您 运行 使用 xcodebuild
命令的目录中创建的。
现在您可以指向该文件夹以便 运行 ios-sim
命令(有关详细信息,请参阅 ios-sim for more references) or simctl
(see iOS 8: Building custom simulators and Build And Run iOS Apps In Commmand Line)。