From 9bae55743bdc392e8754c310f6f1a411d6c61705 Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Fri, 16 Dec 2016 13:22:17 -0500 Subject: [PATCH] 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." --- script/cibuild | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/script/cibuild b/script/cibuild index 32cfd15..b6c25c9 100755 --- a/script/cibuild +++ b/script/cibuild @@ -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 \