Reputation: 485
Since my last update firebase dashboard is almost empty. At first I did think is new iOS 14.5 policy problem but refer to:
https://firebase.google.com/docs/ios/supporting-ios-14
I play around with settings and noticed that when I use
Analytics.setAnalyticsCollectionEnabled(true)
Firebase starts to provide data in real time as i have -FIRDebugEnabled.
But without calling it, I don't get firebase logs even in console looks like they are not send at all.
Why I need to Analytics.setAnalyticsCollectionEnabled(true)
if there is information This setting is persisted across app sessions. By default it is enabled ?
Or I am just missing something?
In that time I did update pods to newest version for:
pod 'Firebase/Crashlytics'
pod 'Firebase/AnalyticsWithoutAdIdSupport'
pod 'Firebase/Messaging'
Upvotes: 6
Views: 6962
Reputation: 61
Looks like this might be caused by the linker. Especially since FIRAnalytics
is not used anywhere in your project and simply is not linked into the main binary. Then Firebase framework detects that there are no FIRAnalytics
class and is not initiating analytics:
(FIRApp.m)
- (BOOL)configureCore {
[self checkExpectedBundleID];
if (![self isAppIDValid]) {
return NO;
}
// Initialize the Analytics once there is a valid options under default app. Analytics should
// always initialize first by itself before the other SDKs.
if ([self.name isEqualToString:kFIRDefaultAppName]) {
Class firAnalyticsClass = NSClassFromString(@"FIRAnalytics");
if (firAnalyticsClass) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
SEL startWithConfigurationSelector = @selector(startWithConfiguration:options:);
#pragma clang diagnostic pop
if ([firAnalyticsClass respondsToSelector:startWithConfigurationSelector]) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[firAnalyticsClass performSelector:startWithConfigurationSelector
withObject:[FIRConfiguration sharedInstance].analyticsConfiguration
withObject:_options];
#pragma clang diagnostic pop
}
}
}
As I see there are two possible solutions:
FIRAnalytics
(for Objective-C) or Analytics
(for Swift) from FirebaseAnalytics
somewhere in your main binary to force the linker to link it.FirebaseAnalytics
lib. This could be -ObjC, -force_load or even -all_load.I'd personally go with the first option because after some time you will use that class to log your custom events anyway.
Upvotes: 2
Reputation: 1088
Did you perhaps disable collection in your plist file? Doing so would require you to override the setting at runtime in order to enable analytics collection. https://firebase.google.com/docs/analytics/configure-data-collection#objective-c
Upvotes: 0