We're trying to use firebase analytics in our ios app.
Default events seems to be logged with no problem.
5.1.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: screen_view (_vs)
However, only custom event is not logged with this log below.
5.1.0 - [Firebase/Analytics][I-ACS025018] Event not logged. Call +[FIRApp configure]: custom_event_name
I think configurating is following the document. We have two different project's plist for each targets to setting up development environment to use different Firebase projects based on build type or target.
guard let path = Bundle.main.path(forResource: googleServiceInfoPlist, ofType: "plist"),
let opts = FirebaseOptions(contentsOfFile: path) else {
fatalError("Couldn't load config file")
}
FirebaseApp.configure(options: opts)
I guessed multiple plists causes this problem at first, but there was no changes with a GoogleService-Info.plist
and calling FirebaseApp.configure()
.
Sending event's func is just like this.
private func sendToFirebase(_ event: Trackable) {
Analytics.logEvent(event.name, parameters: event.properties)
}
What are the possible causes?
Thank you.
You can enable up to 30 events per project as conversions, in addition to the five that Analytics defines by default. Attribution information associated with an event is collected from the time of enablement forward.
Persistence BehaviorBy enabling persistence, any data that the Firebase Realtime Database client would sync while online persists to disk and is available offline, even when the user or operating system restarts the app. This means your app works as it would online by using the local data stored in the cache.
I solved by myself.
This is caused by setting up cocoapods for embedded framework.
My Podfile was like below,
platform :ios, '11.0'
swift_version = '4.1'
use_frameworks!
target 'AppCore' do
pod 'Firebase/Core'
target 'App' do
inherit! :search_paths
end
end
AppCore
is embedded framework.
pod 'Firebase/xxx'
should be targeted to main app, not embedded framework.
I did:
then tracked customs events correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With