Error when previewing on device

When the Xcode Previews app opens on the device, this is the error message in Xcode: RemoteHumanReadableError: Failed to update preview. Error encountered when sending 'display' message to agent.

I tried cleaning the build folder and quitting then reopening Xcode to no avail.

Using Xcode 12.0.1 previewing on iPhone 11.
Answered by BabyJ in 686717022

I have tried this once more using Xcode 13 beta 5 using a device running iOS 15 beta 8 and it works.

Thank you very much to those who got this working!

For me it's the same problem. I solved this by removing (temporarily, just in order for the preview to be working), the variables which are @FocusState. I comment them. The preview then works. After that, I just remove the commented variables, and test on iPhone and works there too. It's a workaround.

Version 14.2 (14C18) I change my device simulator to any to "Any IOS Device (arm64)" and now is working!

I was able to solve this by trusting the app developer in settings. It's a very un-obvious step that isn't alluded to in the error Xcode Previews gives you.

On your device you're trying to preview on...

  • Open Settings
  • Navigate to General > VPN & Device Management
  • You should see the app you're trying to preview listed in here. If you don't see it, try to build and run the app to the physical device first and then repeat these steps.
  • Select the app and then "Trust" the developer
Error when previewing on device
 
 
Q