firebase-ios-sdk
firebase-ios-sdk copied to clipboard
Add Firebase to iOS app extension
Step 0: Are you in the right place?
- For issues or feature requests related to the code in this repository
file a Github issue.
- If this is a feature request please use the Feature Request template.
- For general technical questions, post a question on StackOverflow
with the
firebase
tag. - For general (non-iOS) Firebase discussion, use the firebase-talk google group.
- For backend issues, console issues, and other non-SDK help that does not fall under one of the above categories, reach out to Firebase Support.
- Once you've read this section and determined that your issue is appropriate for this repository, please delete this section.
[REQUIRED] Step 1: Describe your environment
- Xcode version: 11.7
- Firebase SDK version: 6.7.1
- Firebase Component: Core
- Component version: 6.7.1
- Installation method: CocoaPods
[REQUIRED] Step 2: Describe the problem
The iOS application extension is not connecting with Firebase servers.
Steps to reproduce:
What happened? How can we make the problem occur?
- Create a new app into the firebase
- Follow the steps to integrate the Firebase into the iOS app extension
If you have a downloadable sample project that reproduces the bug you're reporting, you will likely receive a faster response on your issue.
Relevant Code:
class PacketTunnelProvider: NEPacketTunnelProvider {
override func startTunnel(options: [String : NSObject]?, completionHandler: @escaping (Error?) -> Void) {
FirebaseApp.configure()
}
}
Can you share the logs from running your extension?
One thing to note as well: that step requires that Analytics is included in target. If Analytics is excluded, feel free to skip this step. I was under the impression we had a note there specifying this, but I can see what happened to it.
One thing to note as well: that step requires that Analytics is included in target. If Analytics is excluded, feel free to skip this step. I was under the impression we had a note there specifying this, but I can see what happened to it.
Analytics is included in target:
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
Can you share the logs from running your extension?
There aren't logs related to Firebase at all.
If you set a breakpoint on FirebaseApp.configure()
does it get called at all? There should definitely be logs from Firebase if that's called, and even if Analytics is included in the target.
If you set a breakpoint on
FirebaseApp.configure()
does it get called at all? There should definitely be logs from Firebase if that's called, and even if Analytics is included in the target.
It gets called.
<Notice>: [Firebase/Crashlytics] Version 4.1.1
<Notice>: 6.25.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60501000 started
<Notice>: 6.25.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
<Notice>: 6.25.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
<Notice>: 6.25.0 - [Firebase/Analytics][I-ACS031025] Analytics screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
<Notice>: 6.25.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
This may be related to Analytics' (Firedata's) bundle identifier per project restrictions.
I have two bundle identifiers and two separate applications in Firebase. One for the container application and another one for the extension.
See #2896. FirebaseAnalytics is not currently supported for extensions.
@paulb777 How about Crashlytics? Can be used without Analytics?
@madalinsavoaiavrazo works for me. On Firebase I've created a separate app with custom keyboard extension bundle id, and initiated firebase in viewDidLoad of the principle kb class
@nikans I am trying to do exactly that (keyboard extension access firebase). I am able to write/read to/from Firebase when running my app in the simulator but it doesn't work when I run it on my device.
Did you have to set any special permission or entitlement? I also tried to access a shared container using App Groups and it doesn't seem to work either (works fine in the simulator).
@nikans Initiating firebase in the viewDidLoad works for the app extension, but now getting an error "The file “remote_config.json” couldn’t be opened because there is no such file."
@madalinsavoaiavrazo works for me. On Firebase I've created a separate app with custom keyboard extension bundle id, and initiated firebase in viewDidLoad of the principle kb class
What is the principal kb class? I trued to run
override func viewDidLoad() {
super.viewDidLoad()
FirebaseApp.configure()
}
in my extension's CredentialProviderViewController class and it doesn't run.
I try to just include FirebaseApp.configure() outside of a viewDidLoad() and get
Consecutive declarations on a line must be separated by ';'
I can run it inside a function (override func prepareCredentialList) and it seems to work, but my extension won't return a user object, when the main app is definitely authenticated.
When will Firebase start supporting app extensions ?
@wshrads did you ever get it to work for extensions?
@wshrads did you ever get it to work for extensions?
Unfortunately no. Still waiting to hear back from Firebase.
I think extensions need open access to reach use internet.
@msavoaia Crashlytics should just work. Let us know if your issue is resolved since analytics is not supported.
@wshrads if it's a different extension than the one above, can you file a separate issue mentioning which extension you are using and if you can share your sample of using Firebase would be very helpful. thank you!
Anything for 2023? Almost 2024 and iOS App are using extensions now more than ever. Can you solve this by adding an app group as the storage mechanism for the extensions to SAVE and have the main app target upload?
We're not likely to have comprehensive app extension support anytime soon. That said, many of the Firebase products work with many types of app extensions. If you'd like support for a specific use case, please open another issue.
@msavoaia Crashlytics should just work. Let us know if your issue is resolved since analytics is not supported.
@wshrads if it's a different extension than the one above, can you file a separate issue mentioning which extension you are using and if you can share your sample of using Firebase would be very helpful. thank you!
@charlotteliang What do you mean "should just work" - same Firebase app and plist file? Two Firebase apps and the same plist? Two plists? cc @paulb777