I'm having the same problem with an Apple TV 4K 2nd gen on tvOS 14.6 and macOS 11.4 with Xcode 12.5.1. Both are connected via ethernet to the same switch.
(My AppleTV is named "Office")
Hitting play in Xcode results in dialog "Office is not connected". Sometimes the Devices and Simulators window says "Office is locked".
I often can go into remote app and devices settings on the AppleTV, see "Office" in Xcode's Devices and Simulators, click Pair, and entering the code correctly pairs so I can run. (I didn't unpair on either end.)
But sometimes I get stuck where entering the code just shows the "Pair with Office" button again (no error). The only way I was able to break out of that cycle was to:
restart my mac
power off the tvos
unplug and replug the tvos power cable
start up xcode again and connect.
I didn't even have to pair, so maybe there's an issue with unpairing?
Regardless, building for tvOS is a really rough workflow.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: