iOS widget crashing in body getter with -[NSTaggedPointerString identifier]: unrecognized selector sent to instance

Here is the code where the crash occurs

var body: some WidgetConfiguration {
        IntentConfiguration(kind: WidgetKind, intent: ConfigurationIntent.self, provider: provider) { entry in
            // Parse config
            if let config = entry.configuration {
                if let fg = config.foreground,
                   let fgColorId = fg.identifier, <----
                   let fgColors = AppSettings.sharedInstance()?.object(forKey: kWidgetForeground) as? [String:String],
                   let fgColor = fgColors[fgColorId] {
                    theme.textColor = Color.init(UIColor.fromHex(fgColor))
                    theme.iconColor = Color.init(UIColor.fromHex(fgColor))
                } else {
                    theme.textColor = .white//Color.primary
                    theme.iconColor = .white//Color.primary
                }

configuration is INIntent with foreground var which is INObject but some times it seems its not... and instead its NSTaggedPointerString unless I'm missing something here.

Here configuration intent detention

I recommend either migrate to App Intents or testing with primitive types instead of custom objects (to narrow down the issue). Historically there have been issues with SiriKit Intents, custom types and WidgetKit displays. App Intents is the path forward and this bug shouldn't occur with in the new system,

Rico WWDR - DTS - Software Engineer

Is there a good and painless way to migrate users who created widgets using SiriKit intents to AppIntent based widgets?

iOS widget crashing in body getter with -[NSTaggedPointerString identifier]: unrecognized selector sent to instance
 
 
Q