firebase / quickstart-ios

Firebase Quickstart Samples for iOS
https://firebase.google.com
Apache License 2.0
2.79k stars 1.47k forks source link

Firebase Analytics does not work in Broadcast Upload Extension #383

Closed PatrickSCLin closed 6 years ago

PatrickSCLin commented 6 years ago

How to use Firebase Analytics in iOS 11 Broadcast Upload Extension ( ReplayKit 2, Screen Broadcasting) ?

I just setup everything, but see nothing in DebugView, anyone met same situation ?

morganchen12 commented 6 years ago

By DebugView do you mean the console in Xcode's bottom panel?

If so, try setting the logging level programmatically in your extension, since extensions may not respect the -FIRAnalyticsDebugEnabled launch option. You can do so via

[[FIRConfiguration sharedInstance] setLoggerLevel:FIRLoggerLevelDebug];

It's possible analytics events are being correctly logged and just not appearing in Xcode. If you don't see any events in Firebase console after a few hours, then you're likely running into a different issue.

baolocdo commented 6 years ago

Note that extensions won't accept the launch arguments so you won't be able to turn on debug mode on Analytics. Therefore, you won't see debug events on DebugView in real-time. Also, extensions won't allow much background task so it's best effort to upload data as soon as possible when extensions go to the background. Since Analytics uploads data every hour and when app/extensions go to the background, it's possible that some events won't make it right away if an extension's life is too short (a few seconds). You may want to wait for 2-3 hours to see normal events on Analytics dashboard.

PatrickSCLin commented 6 years ago

Lets say user usually uses broadcast upload extension in 10-20 mins, Does Firebase Analytics works in this scenario?

Currently I just put data to an array which stored in app group userdefault, and call logEvent in main app. (workaround)

baolocdo commented 6 years ago

Given 10-20 mins, it should work since it may have enough time to upload. Please give it a try and let us know whether you see any events on the dashboard after a few hours. Thanks

PatrickSCLin commented 6 years ago

I don't think it's functional in iOS11 Screen Broadcasting Extension, I have check big query.

baolocdo commented 6 years ago

Thanks for the update. Do you have any sample project that I can replicate the issue? It would be nice to know the steps to debug such problem. Thanks

morganchen12 commented 6 years ago

For the time being, this is going to continue being unsupported.