34

After adding an extension target to Xcode project and trying to run it on iOS 14, I'm getting an error:

SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (***)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}." UserInfo={NSLocalizedDescription=Failed to show Widget '***' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (***)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}., NSUnderlyingError=0x7f9bac015910 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (***)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (***)}}} Domain: DTXMessage Code: 1

Any idea what is going wrong?

1
  • It's annoying, but restarting my iPhone did make it work for me...
    – pd95
    Nov 18, 2020 at 22:19

16 Answers 16

17

I resolved this problem. Clean Builder Folder(maybe it's not necessary), then restart your iPhone. Run your project again.

1
  • 5
    Wow restarting my device was the key. Baby SwiftUI needs care. Dec 17, 2020 at 14:23
10

For me it was that my device was on iOS 14.1 and the Deployment Target was set to 14.3 for the widget target. The solution was to update the Deployment Target to match your device or lower. The Deployment Target setting is in the General tab and under Deployment Info (in my case I set it to 14.0).

3
  • Alternatively, update to the latest iOS version on your device! (Not every team can change their min deployment target easily, so, just another perspective)
    – Graystripe
    Mar 17, 2021 at 18:55
  • this was it for me
    – jes5199
    Jun 2 at 2:30
  • Was it for me too. Having different deployment targets on the main app and the widget extension.
    – Hongtron
    Aug 20 at 18:28
4

If you have 2 widgets within your target, comment out the widget(s) you arent currently testing

@main
struct Widgets: WidgetBundle
{
    @WidgetBundleBuilder
    var body: some Widget
    {
        Widget1()
//        Widget2()
    }
}
0
4

For me the problem was the excluded arm64 architecture for any iOS simulator on the widget target build settings (Added because of my M1 development device).

When removing this excluded architecture, the widget is running without any problem.

3

If the extension target you added was for a Widget...

I did follow some of the suggestions here and restarted my phone to some success but the error kept happening over and over, and restarting my phone is intrusive and takes kind of a long time. For me, the workaround when I get this popup error is to..

1. On my iPhone, I find the Widget I'm working on and delete it by pressing and holding the widget until it gives me the option to remove it from my device.

2. In Xcode, I build and run the Widget Scheme again, and no more error!

It's a little faster, and I don't have to restart my phone.

Note: If for some reason that doesn't work, I switch my build Scheme back to my iPhone Scheme, build and run, then change the Scheme back to my widget Scheme, and that usually does the trick.

1

I ran into the exact same issue.

For me it happens when I ran an extension widget from an M1 computer.

Turns out the issue was I was running Xcode with Rosetta, turning that off fixed it for me.

To enable / disable rosetta:

  1. Right click on the Xcode app
  2. Click on Get Info
  3. Untick Open using Rosetta
  4. Clean project => Restart Xcode
1

For me this was fixed

  • running the app scheme instead of the widget extension scheme first
  • trust the developer
  • then I switched to run the widget extension scheme.
1

For me what did not fix it was cleaning derived data, restarting the simulator etc (well, maybe they also helped). What got it working was re-deploying the main app first, before running the WidgetExtension scheme once more.

Note: I first had to fix the bundle ID of my main app because it did not have the same prefix as the widget extension target did. So probably that's why the main target needed deploying again first.

0

Try to go to Setting -> General -> Profiles & Device Management -> Trust your cert, and then rebuild and rerun app.

0

This happened to me after moving my entitlements file from the root directory into the widget's directory. I tried this answer but the problem persisted.

I had to manually install the widget on the Home Screen. After that running from Xcode worked again.

0

Short answer:
Make sure that your extension (e.g. a widget target) has its entry point marked with @main.

Long answer:
I had an app with watchOS widgets, and I am developing additional iOS widgets. I added a new target, and it worked. Both extensions had their own entry point marked with @main.
Then I realized that nearly all of the code was the same for both targets. I merged them and removed the individual files. But I forgot to mark the new code with @main. This caused the error.
As soon as I added @main, everything worked again.

0

Same happened to me and the issue was because the Runpath Search Paths (LD_RUNPATH_SEARCH_PATHS) was empty. I cleared that build setting by mistake. I added @executable_path/Frameworks to the Runpath Search Paths, which was the right setting for my case, and the widget started working again.

0

I've been having this issue, looks like a fairly unique case for me.

I'm using Arrays in my Intent Parameter

struct ConfigureWidgetIntent: WidgetConfigurationIntent {
    static var title: LocalizedStringResource = "Configure Widget"
    
    @Parameter(title: "Entry Type", default: [EntryType.note])
    var entryTypes: [EntryType]
    
    init() {}
    
    init(entryType: [EntryType]) {
        self.entryTypes = entryType
    }
}

When I replace the array type with just EntryType, it seems to build fine. This must be a bug, because it has compiled correctly with Arrays before, once or twice, and allows me the multiselect option in the edit widget

0

I'm using Flutter to connect to Swift to make this widget, I hadn't ran

flutter build ios --config-only

And then, I also forgot to add @main to the struct for the Widget. This should be the struct that implements the Widget protocol.

This worked for me!

0

I was forgetting that i am working with more than one target. So be sure to select the main target when running the app: I was testing live activities but this should be your app, not the activity or secondary target.

enter image description here

-2

As mentioned here https://developer.apple.com/forums/thread/651611, setting New Build System in File -> Workspace/Project settings (for both Shared and Per User settings) seems to do the trick. You won't get rid of the warning, but the widget might (see notes) run.

Note 1 - even after this change, there seems to be about 30 % chance that it wont run. Just hit Run again 🤷‍♂️. (Debug Navigator stuck on Waiting to Attach)

Note 2 - sometimes this doesn't work altogether. Setting Build System to Legacy and back to New worked for me 🤦‍♂️.

Note 3 - running on device is so far without these problems (iOS 14 beta 7)

Tested on Xcode 12 beta v6.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.