Can't view SwiftUI previews on Vision Pro because of code signing

Hello! I'm making an app for VisionOS. I can run the app on my Vision Pro, and I can see the SwiftUI previews in the simulator, but for some reason the previews refuse to run on the device.

Here's what I'm seeing:

== PREVIEW UPDATE ERROR:

    AppHostMustHaveGetTaskAllowError: Cards.app not code signed properly
    
    ”Cards.app” must be code signed in order to use on-device previews. Check your code signing settings for the target.

As far as I can tell, the code signing settings are correct because the app itself runs just fine on the device. I'm not sure what to do…

Hi,

Sorry to hear you are having problems getting on-device previews working. We have seen some issues in this area recently. One workaround you can try is in Xcode's menu bar enable Editor > Canvas > Use Legacy Previews Execution

If not that doesn't help, the best next step will be to file a feedback with diagnostics so we can take a look.

Steps to generate helpful diagnostics:

  1. Download and install the logging profile on all devices involved. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift
  2. Reproduce the issue
  3. Click the "Diagnostics" button in the error banner in Previews' Canvas area (or if the banner is missing you can use the menu: Editor > Canvas > Diagnostics)
  4. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  5. Attach (or make from the folder) the resulting zip file to the bug report (will be named something like previews-diagnostics-0123456789.zip)
  6. Generate the sysdiagnose(s) and attach those too
Can't view SwiftUI previews on Vision Pro because of code signing
 
 
Q