I'm trying to implement continuous integration using travis-ci.org.
Here is my current .travis.yml config:
language: swift
osx_image: xcode8.3.3
xcode_project: AutomatediOSBuild.xcodeproj #3
xcode_scheme: Debug
#xcode_sdk: iphonesimulator10.0
script:
- xcodebuild -scheme AutomatediOSBuild -project AutomatediOSBuild.xcodeproj -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6s,OS=10.3.1' build test
But I'm getting the following error on travis:
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ platform:iOS Simulator, OS:10.3.1, name:iPhone 6s }
The requested device could not be found because no available devices matched the request.
The command "xcodebuild -scheme myProject -project myProject.xcodeproj -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6s,OS=10.3.1' build test" exited with 70.
If I run in the command line:
xcodebuild -scheme myProject -project myProject.xcodeproj -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6s,OS=10.3.1' build test
I have no errors. Any of you knows why I'm getting this errors? or if there is any work around this error?
I'll really appreciate your help.
The Travis environment for xcodebuild is likely different from yours, namely you have locally the correct Simulator corresponding to your -destination
option, but your Travis-ci container does not.
The Job logs should give you a bit more info, like :
The requested device could not be found because no available devices matched the request.
585
586 Available destinations for the "stackoverflow" scheme:
587 { platform:iOS Simulator, id:5B...65, OS:13.2.2, name:iPad (7th generation) }
588 { platform:iOS Simulator, id:1A...DA, OS:13.2.2, name:iPhone 8 }
Travis lists the available simulators for the selected osx_image
on the documentation, and this mokacoding post gives good explanations.
I also found out that you must give the exact OS version, e.g. in my example above:
xcode_destination: platform=iOS Simulator,name=iPhone 8,OS=13.2 # fails
xcode_destination: platform=iOS Simulator,name=iPhone 8,OS=13.2.2 # works