Search code examples
iosswiftwidgetios17customintents

Widget not loading on iOS 17 beta, "Missing backing store for Intent" error


I work on an iOS app supporting iOS 15 and above, with a widget supporting iOS 16 and above.

The widget currently does not load on iOS 17 beta, for users it's just an empty box, both during snapshot preview while choosing the widget size, and after placing it on the home screen.

When building it from Xcode, I get the following error:

-[INIntent _initWithIdentifier:backingStore:schema:error:] Missing backing store for Intent: {xxx-xxx-xxx some ID} (N/A - N/A)

The app uses a custom Intent to allow some settings on the widget. The widget and app share data through an App Group to avoid duplication of network requests.

I could not find any information on this error on SO, nor on Apple beta release notes. Is anybody experiencing this as well?


Solution

  • Have you tried to add

    let configuration: ConfigurationAppIntent in the TimeLine Entry?

    Example:

    struct SimpleEntry: TimelineEntry {
         let date: Date
         let configuration: ConfigurationAppIntent
         let character: CharacterDetail
     }
    
    
    func placeholder(in context: Context) -> SimpleEntry {
        SimpleEntry(date: Date(), configuration: ConfigurationAppIntent(), character: .panda)
    }
    
    func snapshot(for configuration: ConfigurationAppIntent, in context: Context) async -> SimpleEntry {
        SimpleEntry(date: Date(), configuration: ConfigurationAppIntent(), character: .panda)
    }
    

    This code is generated automatically, and basically it's the view that you see when the widget turns or spins to the other side

    import WidgetKit
    import AppIntents
    
    struct ConfigurationAppIntent: WidgetConfigurationIntent {
        static var title: LocalizedStringResource = "Configuration"
        static var description = IntentDescription("This is an example widget.")
    
        // An example configurable parameter.
        @Parameter(title: "Favorite Emoji", default: "😃")
        var favoriteEmoji: String
    }
    

    This worked for me using the example EmojiRangers