I'm in a strange situation where I can get xctool to run my test but I cant figure out the equivalent command line to get xcodebuild and/or fastlane scan to run my tests.
I have an iPad only application with a single scheme and two targets (otto and ottoTests)
Working XCTool Commandline
xctool -scheme otto \
-sdk iphonesimulator \
CODE_SIGN_IDENTITY=""\
CODE_SIGNING_REQUIRED=NO \
-reporter pretty\
-reporter junit:./test-reports/otto.xml\
build test
Xcodebuild - fail
xcodebuild -sdk iphonesimulator \
-scheme otto \
test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
I get this error that
A build only device cannot be used to run this target
So I'm kind of at a loss here exactly what is different between xcodebuild and whatever xctool is running.
AFAICS, you are missing the -destination argument in the xcodebuild command. Refer to this tutorial for sample code.
You're missing the -destination argument.
xcodebuild \
-workspace MyApp.xcworkspace \
-scheme MyWatchKitApp
-destination 'platform=iOS Simulator,name=iPhone 6,OS=9.1' \
build
To list all valid values for destination run instruments -s devices.
e.g.
$ 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)
Unfortunately you can't just copy and paste these lines. You'll need to use your impressive human pattern matching skills to fill in the proper values for the platform=, name=, and OS= parameters to -destination.
Source http://www.mokacoding.com/blog/xcodebuild-destination-options/
Related
I got this error when i ran
ionic cordova run ios --device
65%] PreflightingApplication
2019-06-24 14:28:21.032 ios-deploy[7890:179934] [ !! ] Error 0xe800007e: The device OS version is too low. AMDeviceSecureInstallApplication(0, device, url, options, install_callback, 0)
ios-deploy: Command failed with exit code 253
[ERROR] An error occurred while running subprocess cordova.
cordova run ios --device exited with exit code 253.
My
output for xcodebuild -showsdks
i
OS SDKs:
iOS 11.2 -sdk iphoneos11.2
iOS Simulator SDKs:
Simulator - iOS 11.2 -sdk iphonesimulator11.2
macOS SDKs:
macOS 10.13 -sdk macosx10.13
tvOS SDKs:
tvOS 11.2 -sdk appletvos11.2
tvOS Simulator SDKs:
Simulator - tvOS 11.2 -sdk appletvsimulator11.2
watchOS SDKs:
watchOS 4.2 -sdk watchos4.2
watchOS Simulator SDKs:
Simulator - watchOS 4.2 -sdk watchsimulator4.2
Have you tried overriding the deployment target? Try adding to your config.xml:
<platform name="ios">
<preference name="deployment-target" value="11.2" />
</platform>
I used Xcode 9.0 and iPhone 7 in my development.
In my .travis.yml I added:
language: swift
osx_image: xcode9
script:
- xcodebuild clean test -project BullsEye.xcodeproj -scheme BullsEye
-destination "platform=iOS Simulator,name=iPhone 7,OS=11" CODE_SIGN_IDENTITY=""
CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO -quiet
but when I run it in travis I get this:
The command "xcodebuild clean test -project BullsEye.xcodeproj -scheme BullsEye
-destination "platform=iOS Simulator,name=iPhone 7,OS=11" CODE_SIGN_IDENTITY=""
CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO -quiet" exited with 70.
or with 66.
I made my scheme Shared in Xcode.
What is the problem and how can I fix it?
In logs I'm also getting:
Ineligible destinations for the "BullsEye" scheme:
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Generic iOS Device }
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Generic iOS Simulator Device }
and
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ platform:iOS Simulator, OS:11, name:iPhone 7 }
The requested device could not be found because no available devices matched the request.
Looking at your latest build log, the following error message
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ platform:iOS Simulator, OS:11, name:iPhone 7 }
seems to indicate that you aren't using a valid -destination value.
Indeed, I believe that 11 isn't an accepted value for OS. Can you try with 11.0 instead? i.e. -destination "platform=iOS Simulator,name=iPhone 7,OS=11.0"
I've also submitted a PR here.
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
I had a similar issue with a target I created with Xcode 9.4 and was trying to run on travis with Xcode 9.3. The tvOS deployment target in Build Settings was 11.4. I changed it back to 11.1 and travis started working:
--- a/GoogleUtilities/Example/GoogleUtilities.xcodeproj/project.pbxproj
+++ b/GoogleUtilities/Example/GoogleUtilities.xcodeproj/project.pbxproj
## -974,7 +974,7 ##
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
TARGETED_DEVICE_FAMILY = 3;
- TVOS_DEPLOYMENT_TARGET = 11.4;
+ TVOS_DEPLOYMENT_TARGET = 11.1;
};
React Native Docs:
https://reactnative.dev/docs/running-on-simulator-ios
1. View Devices:
xcrun simctl list devices
2. Look for the id for your device (The issue is that it doesn't match):
6FC6D243-9AD0-4CA5-BCD0-3AE32D536A27
3. Run iOS Simulator with new ID
npx react-native run-ios --udid=6FC6D243-9AD0-4CA5-BCD0-3AE32D536A27
I am having issue with Travis building and testing a new ios app I am being developing.
language: objective-c
os: osx
osx_image: xcode8
before_install:
- pod repo update > /dev/null
- pod update
- gem install xcpretty
script:
- xcodebuild clean test -workspace project.xcworkspace -scheme project -destination "platform=iOS Simulator,name=iPhone 6" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO
This is my .travis.yml and everytime I run it Travis get me this error:
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ platform:iOS Simulator, OS:latest, name:iPhone 6 }
Ineligible destinations for the "project" scheme:
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Generic iOS Device }
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Generic iOS Simulator Device }
The command "xcodebuild clean test -workspace project.xcworkspace -scheme project -destination "platform=iOS Simulator,name=iPhone 6" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO" exited with 70.
I also tried putting the id of the simulator with the same result.
Please note that the same xcodebuild command is building without any issue in my workarea.
Make sure your iOS Deployment Target value in Build Settings is set to a value that your osx image on Travis supports.
If your app is brand new, the iOS Deployment Target may be set to 10.1. The newest image Travis is providing comes with Xcode 8.0, which does not have iOS 10.1 simulators in them yet.
Update
Travis-CI is supporting xcode8.1 and iOS 10.1
I am running test using xctool, and I would like to be able to choose the simulator. I am using the following line:
xctool -workspace MyProject.xcworkspace -scheme MyProject test -reporter junit:test-results.xml -reporter teamcity -sdk iphonesimulator
However, the simulator that is open is the iPhone 4s simulator. Does anybody knows how to select the iPhone 6 simulator.
Using the -destination flag you can select a specific device to be run for your simulator :
-destination platform='iOS Simulator',OS=8.4,name='iPhone 6'
You should try the following command (replacing MyProject by the name of your project):
xctool -workspace MyProject.xcworkspace -scheme MyProject test -reporter junit:test-results.xml -reporter teamcity -sdk iphonesimulator -destination platform='iOS Simulator',OS=8.4,name='iPhone 6'