Saturday, April 18, 2026
HomeiOS DevelopmentiOS Widgets: Configuring A number of Firebase Setting in Widget Extensions

iOS Widgets: Configuring A number of Firebase Setting in Widget Extensions

[ad_1]

I’ve arrange a number of Firebase environments that permit me to level to totally different Firebase initiatives when the app is launched in DEBUG or RELEASE configuration. I don’t comply with the Firebase documentation as a consequence of potential analytics points indicated, so I carried out it utilizing the tactic on this Medium put up. All is nice for the principle app goal.

Now, I’m making an attempt to implement the identical for my Widget Extension and Intents, however my widgets all the time crash with:

*** Terminating app as a consequence of uncaught exception ‘com.firebase.core’, cause: ‘FirebaseApp.configure() couldn’t discover a legitimate
GoogleService-Information.plist in your challenge. Please obtain one from
https://console.firebase.google.com/.’

I duplicated the steps within the Medium put up for the Widgets and Intents, ie:

  1. Downloaded the GoogleService-Information.plist for each prd and dev environments, and created the directories within the Widgets and Intents targets. I additionally ensured they don’t seem to be added to targets and unchecked “Copy gadgets if wanted” in accordance with the put up.
  2. Added the Run Scripts to each Widgets and Intents targets respectively, and ensured they’re earlier than “Copy Bundle Sources”.

Code that I exploit to initialize Firebase within the Widgets as instructed on this SO put up:

import Firebase

struct MyWidget: Widget {
    let form: String = "MyWidgetKind"
    
    init() {
        FirebaseApp.configure()
    }

    var physique: some WidgetConfiguration {
        IntentConfiguration(form: form, intent: MyIntent.self, supplier: Supplier()) { entry in
            MyEntryView(entry: entry)
        }
        .configurationDisplayName("Lorem ipsum")
        .description("Lorem ipsum")
    }
}

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments