6

I want to gather some info of the users who are using the action extension of my iOS app with google firebase analytics. It works well with the main app. But how to make it work with the extension? Is there a way to do that? I tried to create 2 apps on google firebase console(since main app and the action extension have different bundle ids), seems don't work.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
jokeman
  • 1,277
  • 9
  • 22
  • Is the Action Extension its own standalone app that users download from the App Store? Have you already integrated the Firebase SDK and added the appropriate GoogleService-Info.plist to the project and called [FIRApp configure] at startup? – Steve Ganem Jul 13 '16 at 21:28
  • @Frank van Puffelen , The action extension is not a standalone app. But it has a different bundle id from the main app. The main app is working fine with firebase. So I should have Integrated SDK and imported GoogleService-Info.plist correctly. – jokeman Jul 13 '16 at 22:11
  • I've been trying to accomplish the same thing. Unfortunately it appears Firebase is batching the analytics calls and using the app delegate methods to determine when to send them, but app delegate methods aren't called for extensions. I'd be interested to know if anyone has been able to make this work. – alivingston Jul 19 '16 at 21:10

2 Answers2

4

According to an answer from Firebase support. What we should do is putting the [FirApp configure] at the entry point of the extension. For the action extension, I just put it at the first line under [super viewDidLoad] in viewDidLoad method.
And yes, a separate GoogleService-Info.plist file is needed.

jokeman
  • 1,277
  • 9
  • 22
  • That's exactly how I managed to do this for Firebase Database and it basically works. However I have another problem with `persistenceEnabled` but that's another story. – cybergen Sep 22 '16 at 22:50
0

[FirAPP configure] method is not working like this way. May be, Google did not updated their documentation yet. I have summarised the tutorial here.

iOS Admob Firebase SDKs with/without cocoapods

Community
  • 1
  • 1
Jamshed Alam
  • 12,424
  • 5
  • 26
  • 49