Widget SwiftUI previews failure when adding a dependency

Repro steps:
  • Create new project

  • Create WidgetKit extension (verify that previews work)

  • Create dummy framework (verify that previews still work)

  • Link dummy framework to the widget extension

At that point, preview stops working with the following error:

"RemoteHumanReadableError

ProcessError: Failed to launch widget extension: The operation couldn’t be completed. (CHSErrorDomain error 1050.)"

What can I do to make this work?

It might be related to this https://developer.apple.com/forums/thread/651343, though the other discussion seems to focus on SwiftPM packages if I understand correctly.
Howdy,

Sorry to hear you are having problems getting previews working. Best next step will be to file a feedback with diagnostics.

We will need the diagnostics Xcode Previews generates in order to make sure we understand the error the previews system is encountering.
  1. When you get an error in Xcode Previews, an error banner appears in the canvas

  2. Click the "Diagnostics" button in that banner

  3. In the sheet that appears, click "Generate Report" in the bottom left of the sheet

  4. Attach (or make from the folder) the resulting zip file to the bug (will be named something like previews-diagnostics-0123456789.zip)

Please report back here with the feedback number and I'll make sure it gets to the right team.

Thanks!
@aurelienporte

I am having the same problem but did not find any way to fix it. Did you solve it somehow? Thanks!
@aurelienporte / @totalidea,

Check that the package dependency was added to your targets under General -> Frameworks & Libraries
I am creating a widget that has configurable content and I'm getting this error on the Mac OS when running the WidgetExtension in the Mac WidgetKit Simulator
The operation could not be completed. (CHSErrorDomain error 1101.)

I must be missing something somewhere, all my other widgets are working fine, but with the dynamic widget where the user can edit the widget in the swift file I'm always getting warnings that appear then disappear about
Cannot find type 'DynamicPersonSelectionIntent' in scope
When I build it goes away.

I have added DynamicPersonSelection.intentdefinition, I have an IntentHandler.swift with an IntentHandler: DynamicPersonSelectionIntentHandling.in the Target Intent handler I have added the supported Intent, In the framework section is the Intents.framework. I have check all the Tagret memberships I think. The widget works sometimes? on the iPhone but not on the Mac at all.

I must be missing something. Please help if you can.
I have same problem with error CHSErrorDomain error 1050 on my MBP M1
I try to add new widget target in my existing project. Default widget implementation generates error in canvas.
Strange thing that widget opens successfully on my iMac and MacBook Pro(x86). Same Xcode version is installed on all devices.
Report: https://www.icloud.com/iclouddrive/0VlLAd9Je2GVMMXWhAZVLOI9A#previews-diagnostics-20210316-163845

Here we are a year later and this issue still is coming up. Apple, you are getting as bad as Micro$oft.

Same issue on Xcode 13.4.1 MacBook Air M1 (OS: 12.5.1) ProcessError: Failed to launch widget extension: The operation couldn’t be completed. (CHSErrorDomain error 1050.)

Why did you restrict to SwiftUI only if I can't use preview?

Same error. Xcode Version 14.0 (14A309), Apple M1 iMac (24-inch, M1, 2021) with macOS 12.6 (21G115). Feedback FB11598250 filed, including code, screenshots, and diagnostics. Preview did work at one time, but now it's this:

RemoteHumanReadableError: Failed to launch widget extension

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

|  RemoteHumanReadableError
|  
|  NSError: Error Domain=CHSErrorDomain Code=1300 "(null)"

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

|  MessageSendFailure: Message send failure for <ServiceMessage 151: relaunch>
Widget SwiftUI previews failure when adding a dependency
 
 
Q