Error when trying to preview using Mac as Preview Device from Dynamic framework

Hi community:

I came up with an error when I tried to preview a view with Mac as Device. The view is done inside a dynamic framework. The framework is compatible with Mac Catalyst. The Xcode version is 14.2.0

HumanReadableNSError: connectToPreviewHost: Failed to connect to 62826: Error Domain=com.apple.dt.ProcessAttachUtilities Code=0 "Failed to get task for pid 62826: 0" UserInfo={NSLocalizedDescription=Failed to get task for pid 62826: 0}



com.apple.dt.xcodepreviews.service (17):



==================================



|  MessageSendFailure: Message send failure for Connecting to launched interactive agent 62826

Any kind of preview displays the error (only on Mac, on other devices it works as expected). Is there any workaround?

Thanks in advance

Hi,

Sorry to hear you are having problems getting previews working. This error can often indicate a crash in your application when it launches, or a problem with the simulator. If you look into the folder ~/Library/Logs/DiagnosticReports, do you see any crash reports for your app?

If not, the best next step will be to file a feedback with diagnostics so we can take a look. We will need the diagnostics Xcode Previews generates in order to make sure we understand the error the previews system is encountering.

If you are having issues with macOS, catalyst or on-device iOS previews then download and install the logging profile for your device. Instructions and profiles are available here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=swift Attach the sysdiagnose to the bug report as well as the diagnostics using the instructions below.

Then when you get an error in Xcode Previews, an error banner appears in the canvas

  1. Click the "Diagnostics" button in that banner (or if the banner is missing you can use the menu: Editor > Canvas > Diagnostics)
  2. In the sheet that appears, click "Generate Report" in the bottom left of the sheet
  3. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)
Error when trying to preview using Mac as Preview Device from Dynamic framework
 
 
Q