Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code ‘70’

Error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code ‘70’ for Apple TVOS 15.3.

Hello,

I am facing an issue with my AppleTV - TVOS 15.3 test automation set up and configuration. I am able to launch my apps manually, but not working when i’m executing via Appium inspector as well as appium script. Getting error as xcode build failure 70.

The proper set up has been followed for the configuration, but seems like some issues with the WebDriver agent or Appium - Appium project is able to build successfully.
Version Details as follows:-
Xcode 13.3, Mac OS- 12.5, Appium 1.22.3 . Installed all the necessary packages required for the set up as well. Able to build the xcode project successfully.

From the showXcode logs i can see the device is not getting identified.

xcodebuild: error: Unable to find a destination matching the provided destination specifier:
[W3C] 		{ id:e833be5a2126fa8cd6d853f3592ec4aff78ca07a }
[W3C] 	The requested device could not be found because no available devices matched the request.
[W3C] 	Available destinations for the "WebDriverAgentRunner_tvOS" scheme:
[W3C] 		{ platform:tvOS, id:e833be5a2126fa8cd6d853f3592ec4aff78ca07a, name:Bedroom }
[W3C] 		{ platform:tvOS Simulator, id:A94F219F-18D6-4B16-A3BD-0B0237628FED, OS:15.4, name:Apple TV }
[W3C] 		{ platform:tvOS Simulator, id:EC6861CE-8EDC-4BB0-87CE-96F37C8243FC, OS:15.4, name:Apple TV 4K (2nd generation) }
[W3C] 		{ platform:tvOS Simulator, id:AC569E17-71D0-42B8-A33E-EF04592E8A4D, OS:15.4, name:Apple TV 4K (at 1080p) (2nd generation) }
[W3C] 	Ineligible destinations for the "WebDriverAgentRunner_tvOS" scheme:
[W3C] 		{ platform:tvOS, id:dvtdevice-DVTiOSDevicePlaceholder-appletvos:placeholder, name:Any tvOS Device }
[W3C] 		{ platform:tvOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-appletvsimulator:placeholder, name:Any tvOS Simulator Device }. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
[W3C]     at quitAndUninstall (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:585:15)
[W3C]     at /Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:620:11`

Currently blocked in this state and welcoming suggestions/help would be much appreciated.

Thanks in Advance

Xcode is having some internal problem. I would remove any installed WDA instances from the TV, and hard reboot the TV and the Mac. Next, you’ll have to use Xcode to verify that the TV is accessible and ‘trusts’ the Mac.

If Xcode fails, Appium will not work, period. There are a number of issues filed about this kind of thing, they all basically follow this one:

FWIW- Xcode 13.3 should be fine for TVOS 15.3:

Xcode Wiki

Hi we are facing similar issue after upgrading to xcode 14 and while trying to connect to ios 16,
but code is 65 Error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code ‘65’ tried all possible solutions online but stil facing this. any suggestions?

Error 65 is actually a different error than error 70. You should start a new thread to avoid confusion.

Hello @wreed,
Thanks for the reply
I double checked the configuration again after my Apple TV reset. The Device is paired with Xcode and the webDriver Agent project has been built successfully, but could see that WDA instance is not getting installed on my TV after built succeeded, Cleared the xcode derived data and tried as well. Raised a case issue to Apple Developer support and they were helpless on supporting 3rd party vendor apps. Its an issue with the WDA/ Appium.

I tried to launch my app again via Appium inspector and getting the same error.
Appium logs for Reference:-

[WebDriverAgent] xcodebuild exited with code ‘70’ and signal ‘null’
[WebDriverAgent] Launching WebDriverAgent on the device
[WebDriverAgent] WebDriverAgent does not need a cleanup. The sources are up to date (1663302807357 >= 1663302807357)
*[debug] [WebDriverAgent] Killing running processes 'xcodebuild.e833be5a2126fa8cd6d853f3592ec4aff78ca07a’ for the device e833be5a2126fa8cd6d853f3592ec4aff78ca07a…
*[debug] [WebDriverAgent] 'pgrep -if xcodebuild.e833be5a2126fa8cd6d853f3592ec4aff78ca07a’ didn’t detect any matching processes. Return code: 1
[debug] [WebDriverAgent] Beginning test with command ‘xcodebuild build-for-testing test-without-building -project /opt/homebrew/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner_tvOS -derivedDataPath /Users/Library/Developer/Xcode/DerivedData/WebDriverAgent-fxmsedpwfaalxlbcwefbceeuodem -destination id=e833be5a2126fa8cd6d853f3592ec4aff78ca07a IPHONEOS_DEPLOYMENT_TARGET=15.3 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO’ in directory ‘/opt/homebrew/lib/node_modules/appium/node_modules/appium-webdriveragent’

Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 70
[debug] [W3C] xcodebuild error message:
[debug] [W3C] . Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
[debug] [W3C] at quitAndUninstall (/opt/homebrew/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:585:15)
[debug] [W3C] at /opt/homebrew/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:620:11
[debug] [W3C] at wrapped (/opt/homebrew/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:60:13)
[debug] [W3C] at retry (/opt/homebrew/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:43:13)
[debug] [W3C] at retryInterval (/opt/homebrew/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:70:10)
[debug] [W3C] at /opt/homebrew/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:600:7

Well that is absolutely not true. Error 70 is coming from Xcode (specifically xcodebuild), not from WDA or Appium.

I’m surprised this doesn’t say TVOS_DEPLOYMENT_TARGET. I don’t test Apple TV’s but I would think this might be part of the problem. iOS 15.3 and TVOS 15.3 are two very different animals.

in xcode project, the deployment target for TVOS is set to AppleTV and version as 15.3. I am not sure why its fetching as IPHONEOS.

Also i tried to change it to TVOS_DEPLOYMENT_TARGET through command line.

xcodebuild build-for-testing test-without-building -project /opt/homebrew/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner_tvOS -derivedDataPath /Users/Library/Developer/Xcode/DerivedData/WebDriverAgent-fxmsedpwfaalxlbcwefbceeuodem -destination id=e833be5a2126fa8cd6d853f3592ec4aff78ca07a TVOS_DEPLOYMENT_TARGET=15.3 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO…

But it returned with the original error:-

xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ id:e833be5a2126fa8cd6d853f3592ec4aff78ca07a }

The requested device could not be found because no available devices matched the request.

Available destinations for the "WebDriverAgentRunner_tvOS" scheme:
	{ platform:tvOS, id:e833be5a2126fa8cd6d853f3592ec4aff78ca07a, name:Bedroom }
	{ platform:tvOS Simulator, id:A94F219F-18D6-4B16-A3BD-0B0237628FED, OS:15.4, name:Apple TV }
	{ platform:tvOS Simulator, id:553FA7FF-8446-4016-B02D-81F9E650EEFC, OS:15.4, name:Apple TV }
	{ platform:tvOS Simulator, id:EC6861CE-8EDC-4BB0-87CE-96F37C8243FC, OS:15.4, name:Apple TV 4K (2nd generation) }
	{ platform:tvOS Simulator, id:AC569E17-71D0-42B8-A33E-EF04592E8A4D, OS:15.4, name:Apple TV 4K (at 1080p) (2nd generation) }

Ineligible destinations for the "WebDriverAgentRunner_tvOS" scheme:
	{ platform:tvOS, id:dvtdevice-DVTiOSDevicePlaceholder-appletvos:placeholder, name:Any tvOS Device }
	{ platform:tvOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-appletvsimulator:placeholder, name:Any tvOS Simulator Device }

For whatever reason, Xcode can’t find the device at build time. I don’t know enough about Xcode to give you good advice here. I will do some searching but am not confident in finding the answer.

Has there been any updates or findings on this? I have the same issue. No xcodebuild command I run works for tvOS works. I keep getting the same error The requested device could not be found because no available devices matched the request. even though the device can be seen in the list of available devices

Nothing seen as of now - https://developer.apple.com/forums/thread/715187.
I am also blocked and workaround seems like upgrading Xcode to 14 and use Appium 2.

I actually have been getting this issue with Xcode 14 and tvOS 15.6. Issue seems to be with xcodebuild itself. I have tried creating a dummy tv app and building the unit tests via xcodebuild and get the same error