Create a new simulator device to avoid xcodebuild exit status 70

The Travis CI Xcode 8.2 image has two simulator devices for each device type for the latest iOS.
The previous destination specifier caused xcodebuild to fail with exit status 70 and the error message:
"The requested device could not be found because multiple devices matched the request."
This commit is contained in:
Matt Rubin 2016-12-16 13:22:17 -05:00
parent 4198f090fe
commit 9bae55743b

View File

@ -64,12 +64,21 @@ elif [ "$SCHEME" == "SwiftGit2-iOS" ]; then
echo "*** Prebuilding OpenSSL"
"$SCRIPT_DIR/update_libssl_ios"
echo "*** Creating a simulator for testing..."
# Create a new simulator device and reference it by id to avoid xcodebuild exit status 70 with the following errors:
# "The requested device could not be found because no available devices matched the request."
# "The requested device could not be found because multiple devices matched the request."
SIMULATOR_NAME="Custom Simulator"
DEVICE_ID=com.apple.CoreSimulator.SimDeviceType.iPhone-5
RUNTIME_ID=com.apple.CoreSimulator.SimRuntime.iOS-10-2
DESTINATION_ID=$(xcrun simctl create "$SIMULATOR_NAME" $DEVICE_ID $RUNTIME_ID)
echo "*** Building and testing $SCHEME..."
echo
xcodebuild -workspace "$XCWORKSPACE" \
-scheme "$SCHEME" \
-destination "platform=iOS Simulator,name=iPhone 5" \
-destination "id=$DESTINATION_ID" \
-sdk iphonesimulator \
${XCODE_OPTIONS[*]} \
build test \