Running app built in Xcode 14 on iOS 15 results in missing WidgetKit symbol crash

So this is an odd one. I just pushed a build from Xcode 14 for testing and installing that build on iOS 15 causes the app's home screen widgets to disappear. My app is no longer listed when I go to add a widget.

If I run it on iOS 16 everything works fine. If I run it from Xcode 14 to a simulator running iOS 15 everything is fine.

What is happening is on a true iOS 15 device it is failing to find a symbol in the WidgetKit framework.

Here is the output:

Symbol not found: _$s9WidgetKit22IntentTimelineProviderPAAE15recommendationsSayAA0C14RecommendationVy0C0QzGGyF Referenced from: /private/var/containers/Bundle/Application/8B7C4700-E1FD-4174-BD13-B51FBA121B3D/WeatherViewer.app/PlugIns/WeatherWidgetExtension.appex/WeatherWidgetExtension Expected in: /System/Library/Frameworks/WidgetKit.framework/WidgetKit

From what I understand the new "recommendation" method is not needed on iOS and is meant for WatchOS. I have this new method implemented and it's only @available(iOSApplicationExtension 16.0, *) so not sure why it's being called. Even if I remove it completely and try a new build it still has the WidgetKit crash.

Any help would be appreciated. I would love to get this back working and not have to rollback and ditch my iOS 16 additions.

Looks like embedding without signing the WidgetKit.framework in the widgetExtension allows me to run the widgets on iOS 15

the above comment worked for me, at least on Xcode 13.

I have the same issue, but the above comment did not work :/

Embedding without signing didn't solve the issue for me. Still present in the latest beta.

I had the same issue with disappearing Home Screen widgets when running my app in Xcode 14 on an iOS 15 device, and debugging the widgets showed the same missing symbol. The workaround I found was to add the new recommendations function to each IntentTimelineProvider (with @ available so it compiles for iOS 15) with it returning an empty array:

@available(iOSApplicationExtension 16.0, *)
func recommendations() -> [IntentRecommendation<Intent>] {
    return []
}

With this in all my app’s IntentTimelineProviders, the widgets work again when running in Xcode 14 on an iOS 15 device! Perhaps this will work for you too!

EDIT: I think maybe I wasn't seeing files get rebuilt properly because I managed to get it working!

The 'U' references are not necessarily going to cause link issues. Using "nm -m" I can see that the single remaining 'U' when I do include Joe's workaround is for a "weak external" symbol which, presumably, will not cause a link failure:

(undefined) weak external _$s9WidgetKit22IntentTimelineProviderP15recommendationsSayAA0C14RecommendationVy0C0QzGGyFTq (from WidgetKit)

When I don't include the workaround the other 'U' reference is not weak:

 (undefined) external _$s9WidgetKit22IntentTimelineProviderPAAE15recommendationsSayAA0C14RecommendationVy0C0QzGGyF (from WidgetKit)

ORIGINAL COMMENT BELOW:

Joe's solution isn't working for me. I did some investigation to try and work out where the undefined symbol is coming from. If I don't use his workaround, when I use the 'nm' command to look for symbols containing the word "recommendations" in the built widget .appex file I see this:

Villanelle:AdaptivityWidget14Extension.appex geoff$ nm AdaptivityWidget14Extension | grep recommendations
000000010003ff94 t _$s27AdaptivityWidget14Extension22LayoutTimelineProviderV9WidgetKit06IntenteF0AadEP15recommendationsSayAD0I14RecommendationVy0I0QzGGyFTW
00000001000173f4 t _$s27AdaptivityWidget14Extension27DynamicTypeTimelineProviderV9WidgetKit06IntentfG0AadEP15recommendationsSayAD0J14RecommendationVy0J0QzGGyFTW
00000001000292fc t _$s27AdaptivityWidget14Extension27SystemImageTimelineProviderV9WidgetKit06IntentfG0AadEP15recommendationsSayAD0J14RecommendationVy0J0QzGGyFTW
0000000100033b68 t _$s27AdaptivityWidget14Extension28SystemImagesTimelineProviderV9WidgetKit06IntentfG0AadEP15recommendationsSayAD0J14RecommendationVy0J0QzGGyFTW
000000010002c498 t _$s27AdaptivityWidget14Extension32LockScreenLayoutTimelineProviderV9WidgetKit06IntentgH0AadEP15recommendationsSayAD0K14RecommendationVy0K0QzGGyFTW
0000000100077674 t _$s27AdaptivityWidget14Extension37LockScreenSystemImageTimelineProviderV9WidgetKit06IntenthI0AadEP15recommendationsSayAD0L14RecommendationVy0L0QzGGyFTW
                 U _$s9WidgetKit22IntentTimelineProviderP15recommendationsSayAA0C14RecommendationVy0C0QzGGyFTq
                 U _$s9WidgetKit22IntentTimelineProviderPAAE15recommendationsSayAA0C14RecommendationVy0C0QzGGyF

I have six different widgets, each of which is responsible for one of the 't' entries. This indicates those symbols are defined in my .appex. The problem is coming from the 'U' undefined symbols. These need to be resolved at dynamic link time.

According to www . swiftdemangler . com, these two undefined symbols demangle to these names:

_$s9WidgetKit22IntentTimelineProviderP15recommendationsSayAA0C14RecommendationVy0C0QzGGyFTq
method descriptor for WidgetKit.IntentTimelineProvider.recommendations() -> Swift.Array>


_$s9WidgetKit22IntentTimelineProviderPAAE15recommendationsSayAA0C14RecommendationVy0C0QzGGyF
(extension in WidgetKit):WidgetKit.IntentTimelineProvider.recommendations() -> Swift.Array>

The lowercase 't' for my own symbols means they are (according to the man page for nm) "text section symbols" that are "local (non-external)" (that's what lowercase means).

_$s27AdaptivityWidget14Extension22LayoutTimelineProviderV9WidgetKit06IntenteF0AadEP15recommendationsSayAD0I14RecommendationVy0I0QzGGyFTW
protocol witness for WidgetKit.IntentTimelineProvider.recommendations() -> Swift.Array> in conformance AdaptivityWidget14Extension.LayoutTimelineProvider : WidgetKit.IntentTimelineProvider in AdaptivityWidget14Extensio

When I do define the recommendations method in each of my intent timeline providers I get an extra 'T' entry for each of my widgets and one of the undefined symbols disappears:

/Users/geoff/Library/Developer/Xcode/DerivedData/Adaptivity-cckxaccqtttwkcadthuihwqqbxkv/Build/Products/Debug-iphoneos/AdaptivityWidget14Extension.appex
Villanelle:AdaptivityWidget14Extension.appex geoff$ nm AdaptivityWidget14Extension | grep recommendations
000000010003fed8 T _$s27AdaptivityWidget14Extension22LayoutTimelineProviderV15recommendationsSay9WidgetKit20IntentRecommendationVyAA022ADTLayoutConfigurationJ0CGGyF
000000010003ff18 t _$s27AdaptivityWidget14Extension22LayoutTimelineProviderV9WidgetKit06IntenteF0AadEP15recommendationsSayAD0I14RecommendationVy0I0QzGGyFTW
0000000100017298 T _$s27AdaptivityWidget14Extension27DynamicTypeTimelineProviderV15recommendationsSay9WidgetKit20IntentRecommendationVyAA010ADTDynamice13ConfigurationK0CGGyF
00000001000172d8 t _$s27AdaptivityWidget14Extension27DynamicTypeTimelineProviderV9WidgetKit06IntentfG0AadEP15recommendationsSayAD0J14RecommendationVy0J0QzGGyFTW
00000001000291c8 T _$s27AdaptivityWidget14Extension27SystemImageTimelineProviderV15recommendationsSay9WidgetKit20IntentRecommendationVyAA09ADTSysteme13ConfigurationK0CGGyF
0000000100029208 t _$s27AdaptivityWidget14Extension27SystemImageTimelineProviderV9WidgetKit06IntentfG0AadEP15recommendationsSayAD0J14RecommendationVy0J0QzGGyFTW
0000000100033a98 T _$s27AdaptivityWidget14Extension28SystemImagesTimelineProviderV15recommendationsSay9WidgetKit20IntentRecommendationVyAA09ADTSysteme13ConfigurationK0CGGyF
0000000100033ac4 t _$s27AdaptivityWidget14Extension28SystemImagesTimelineProviderV9WidgetKit06IntentfG0AadEP15recommendationsSayAD0J14RecommendationVy0J0QzGGyFTW
000000010002c38c T _$s27AdaptivityWidget14Extension32LockScreenLayoutTimelineProviderV15recommendationsSay9WidgetKit20IntentRecommendationVyAA07ADTLockef13ConfigurationL0CGGyF
000000010002c3cc t _$s27AdaptivityWidget14Extension32LockScreenLayoutTimelineProviderV9WidgetKit06IntentgH0AadEP15recommendationsSayAD0K14RecommendationVy0K0QzGGyFTW
00000001000775e0 T _$s27AdaptivityWidget14Extension37LockScreenSystemImageTimelineProviderV15recommendationsSay9WidgetKit20IntentRecommendationVyAA07ADTLockefg13ConfigurationM0CGGyF
0000000100077620 t _$s27AdaptivityWidget14Extension37LockScreenSystemImageTimelineProviderV9WidgetKit06IntenthI0AadEP15recommendationsSayAD0L14RecommendationVy0L0QzGGyFTW
                 U _$s9WidgetKit22IntentTimelineProviderP15recommendationsSayAA0C14RecommendationVy0C0QzGGyFTq

I don't know enough about linking to know why I still get this outstanding undefined symbol when Joe, presumably, does not.

Does Xcode 14.0 beta 4 did fix the issue for you ?

Since Xcode 14.0 beta 4, I have have a different error but still facing a black Widget on iOS 15.x

It's still crashing for me too. Would be great if this was resolved soon. I have abandoned Xcode 14 and all iOS 16 work for now since 90% of my testers are on iOS 15 and they want their widgets.

I also noticed since Xcode 14 beta 3 that it is replacing/updating a lot of frameworks in the systems /Library/Developer path which now makes Xcode 13 unusable due to obscure build errors during the linking phase. I haven't seen this sort of problem with the Xcode betas since the very early days.

Beta 5 fixed it for me (I didn't try beta 4, I went right from 3).

Running app built in Xcode 14 on iOS 15 results in missing WidgetKit symbol crash
 
 
Q