你错过了-destination
论点。
xcodebuild \
-workspace MyApp.xcworkspace \
-scheme MyWatchKitApp
-destination 'platform=iOS Simulator,name=iPhone 6,OS=9.1' \
build
列出目标运行的所有有效值instruments -s devices
。
例如
$ instruments -s devices
Known Devices:
Apple TV 1080p (10.0) [A0DA01A6-CAC6-4562-93B9-749920DCEFAA] (Simulator)
Apple Watch - 38mm (2.0) [9D6C53FB-0D69-4A0A-83CB-CBB55EE63AA6] (Simulator)
Apple Watch - 38mm (2.0) [BF24D5AC-8DB5-4D18-A6FD-B92292084B8A] (Simulator)
Apple Watch - 42mm (2.0) [286C7921-3689-4832-B0C7-52B412C0C2F5] (Simulator)
Apple Watch - 42mm (2.0) [16144840-5E1B-4934-A82D-E2A49FF79392] (Simulator)
iPad 2 (8.1) [8D0AD02D-C78F-4D59-BBA5-1E7AB452A852] (Simulator)
iPad 2 (9.3) [16D6261C-8FBD-4865-8E6A-840800A96C4A] (Simulator)
iPad Air (10.0) [374DB3F8-65CB-4AD1-919F-808C0C2FCEE1] (Simulator)
iPad Air (8.1) [E83D1680-C5EE-4E86-B847-16FF8C0B7F98] (Simulator)
iPad Air (9.3) [82F4AEC6-A778-44D9-88DB-A95126904E1A] (Simulator)
iPad Air 2 (10.0) [E68ED558-4E83-46A3-892C-93786CF947FC] (Simulator)
iPad Air 2 (9.3) [F1521496-CA53-41CC-A1DA-F605B961B3E5] (Simulator)
iPad Pro (12.9 inch) (10.0) [D87A6656-DEB4-41BB-B45A-2A3D85BFED8A] (Simulator)
iPad Pro (9.3) [968E6D5E-6881-4DB2-B274-2BF0DC0FDE24] (Simulator)
iPad Pro (9.7 inch) (10.0) [55B31895-0A68-4060-8441-A845F63FA4FB] (Simulator)
iPad Retina (10.0) [7725C135-7211-43E2-8BB4-9455C3820DB4] (Simulator)
iPad Retina (8.1) [E4825B7A-5A53-49AF-AD27-62711CA97B66] (Simulator)
iPad Retina (9.3) [F0523C54-9F37-4209-844C-9CA4A174791A] (Simulator)
不幸的是,您不能只是复制和粘贴这些行。您需要使用令人印象深刻的人类模式匹配技能来为 、 和 参数填写platform=
正确name=
的OS=
值-destination
。
来源http://www.mokacoding.com/blog/xcodebuild-destination-options/