我们使用此处记录的设置说明(使用cocoapods)集成了Firebase Analytics: https://firebase.google.com/docs/ios/setup#add_firebase_to_your_app
从xcode(作为调试)启动/构建应用程序时,一切都正常工作。每个事件都被记录下来
来自init的来源:
DDLogDebug(@"FB: Init");
FIRApp *defaultApp = [FIRApp defaultApp];
if (!defaultApp) {
DDLogDebug(@"FB: No default app");
NSString *configPath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"];
if (configPath) {
DDLogDebug(@"FB: Hurraaaa, The firebase GoogleService-Info.plist file is in bundle, configPath: %@", configPath);
NSString *file = [NSString stringWithContentsOfFile:configPath encoding:NSUTF8StringEncoding error:nil];
DDLogDebug(@"FB: File is: %@", file);
FIROptions *options = [FIROptions defaultOptions];
DDLogDebug(@"APIKey = %@", options.APIKey);
DDLogDebug(@"trackingID = %@", options.trackingID);
DDLogDebug(@"googleAppID = %@", options.googleAppID);
DDLogDebug(@"clientID = %@", options.clientID);
DDLogDebug(@"GCMSenderID = %@", options.GCMSenderID);
DDLogDebug(@"androidClientID = %@", options.androidClientID);
DDLogDebug(@"databaseURL = %@", options.databaseURL);
DDLogDebug(@"storageBucket = %@", options.storageBucket);
DDLogDebug(@"bundleID = %@", options.bundleID);
DDLogDebug(@"projectID = %@", options.projectID);
[FIRApp configureWithOptions:options];
DDLogDebug(@"FB: DID CONFIGURE");
} else {
DDLogDebug(@"FB: Warning: The firebase config file is missing.");
DDLogWarn(@"Warning: The firebase config file is missing.");
}
} else {
DDLogDebug(@"FB: Have a default app");
}
记录来源:
NSDictionary *params = [self paramsForTrackingEvent:trackingEvent
usingTrackingEventConfig:trackingEventConfig];
__weak typeof(self) weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
[FIRAnalytics logEventWithName:[[weakSelf conformsString:compiledActionTemplate] pk_truncateByIndex:kFirebaseAnalyticsKeyMaxCount]
parameters:params.allKeys.count > 0 ? params : nil];
});
DDLogDebug(@"*** TRACK [FIREBASE_ANALYTICS,ACTION]: %@", compiledActionTemplate);
我们使用 jenkins 和一些其他 bash脚本自动构建我们的应用程序,它们本身执行生成的xcode构建命令以创建一个生成的ipa。 但是创建的ipa不会记录任何事件。即使ipa在xcode中使用相同的 GoogleService-Info.plist 工作调试版本。
所以我们在我们的应用程序中添加了一些调试日志,并且还要监视来自firebase的日志:
初始化似乎没问题:
standard 10:32:39.941315 +0200 hellfire 5.0.0 - [Firebase/Analytics][I-ACS023007] Firebase Analytics v.50000000 started
standard 10:32:39.941402 +0200 hellfire 5.0.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://xxxxxxxx)
虽然firebase以正确的方式初始化,但在记录事件后会产生一些错误消息:
standard 10:32:41.008690 +0200 hellfire 5.0.0 - [Firebase/Analytics][I-ACS012011] Received empty measurement bundle metadata for getting dictionary representation
standard 10:32:41.010648 +0200 hellfire 5.0.0 - [Firebase/Analytics][I-ACS023068] Data loss. Cannot record event metadata. Error: Error Domain=com.google.gmp.measurement.ErrorDomain Code=2 "Failed to insert/update unknown data type" UserInfo={NSLocalizedDescription=Failed to insert/update unknown data type}
standard 10:32:41.011612 +0200 hellfire 5.0.0 - [Firebase/Analytics][I-ACS034010] Transaction failed
=>这些firebase版本的错误相同:
4.11.0,4.13.0,5.0.1
我们现在花了几天时间检查所有构建设置,Firebase初始化(比较文档),我们不知道什么是错误的。 假设所有Firebase项目都已正确设置,我们还可能缺少什么?
Build-System目前使用此:
High Sierra 10.13.4(17E199), Xcode 9.3 Build 9E145, Cocoapods 1.5.0, Firebase Core 5.0.1