Adding Widget Extension causes an error

Hi all!

I've just added a new widget extension to my project. If I try to compile, I get the following error:

error: Your target is built for iOS but contains embedded content built for the iOS platform (XWidgetExtension.appex), which is not allowed.

in the step

Validate XWidgetExtension.appex

I'm using Xcode Version 12.0 beta (12A6159). My project targets iOS 10.0. It is actually the first time I try to add an extension to the project.

Has anyone seen this error too? Any clues on how could I fix it?

Many thanks for your help!


That's strange, I was able to create a new app test project, set it's deployment version to iOS 10.0, then added a widget extension and it built fine. Looking at my build log, the "Validate" phase only happens for the containing app, not the extension. Were you building the extension target itself, or the app target? Maybe including some of the build log might help.
I'd also strongly encourage you to move your OS target up. Unless you have a specialized app that targets a class of users that cannot upgrade, there's very little reason to be targeting iOS 10. The numbers generally tell the story: https://developer.apple.com/support/app-store. Only 2% of all iOS devices are running lower than iOS 12.
Interesting... When creating a new project from scratch and then trying to add the extension, I've seen a dialog with the following message that hasn't shown when I was trying to add the extension in my other project:

Activate “WidgetTestWidgetExtension” scheme?

This scheme has been created for the “WidgetTestWidgetExtension” target. Choose Activate to use this scheme for building and debugging. Schemes can be chosen in the toolbar or Product menu.

I was just trying to run the App's target because I didn't even had a scheme to run the extension's one... But if I manually create a scheme to run the extension's target, I get the same result.

Yeah, I'd totally like to bump the deployment target, we might do soon, but for now, it is a requirement from the company so not much I can do there sadly...

Thanks for having taken some time to look into this! 👍
Adding Widget Extension causes an error
 
 
Q