【发布时间】:2020-09-01 13:44:49
【问题描述】:
我已经学习了多个教程并阅读了多个 Stackoverflow 帖子,但无论我做什么,我都无法在使用 RNFireBase 的 iOS 应用程序的 DebugView 中显示任何内容。我真的很感激这方面的一些帮助。我已经失去了几天试图解决这个问题,但我不知道出了什么问题。我在模拟器和物理设备上都试过了,但都没有运气。
我正在 XCode 的控制台中显示日志消息,但 Firebase 控制台中没有显示任何内容。以下是我在使用事件时在本地收到的消息:
反应原生
<TouchableOpacity
onPress={() =>
analytics().logSelectContent({
content_type: "clothing",
item_id: "abcd",
})
}
>
<Text>Log message</Text>
</TouchableOpacity>;
日志
2020-05-15 12:22:26.486761-0400 Example App[23464:8820959] 6.13.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: app, select_content, {
content_type = clothing;
ga_event_origin (_o) = app;
ga_screen_class (_sc) = UIViewController;
ga_screen_id (_si) = -3307323385789565728;
item_id = abcd;
}
2020-05-15 12:22:26.487676-0400 Example App[23464:8820959] 6.13.0 - [Firebase/Analytics][I-ACS023073] Debug mode is enabled. Marking event as debug and real-time. Event name, parameters: select_content, {
content_type = clothing;
ga_debug (_dbg) = 1;
ga_event_origin (_o) = app;
ga_realtime (_r) = 1;
ga_screen_class (_sc) = UIViewController;
ga_screen_id (_si) = -3307323385789565728;
item_id = abcd;
}
2020-05-15 12:22:26.500453-0400 Example App[23464:8820959] 6.13.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: select_content, {
content_type = clothing;
ga_debug (_dbg) = 1;
ga_event_origin (_o) = app;
ga_realtime (_r) = 1;
ga_screen_class (_sc) = UIViewController;
ga_screen_id (_si) = -3307323385789565728;
item_id = abcd;
}
2020-05-15 12:22:26.502567-0400 Example App[23464:8821128] 6.13.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 0.9828788042068481
2020-05-15 12:22:26.502616-0400 Example App[23464:8821128] 6.13.0 - [Firebase/Analytics][I-ACS023028] Upload task scheduled to be executed in approx. (s): 0.9828788042068481
2020-05-15 12:22:27.497172-0400 Example App[23464:8821128] 6.13.0 - [Firebase/Analytics][I-ACS002001] Measurement timer fired
2020-05-15 12:22:27.497304-0400 Example App[23464:8821128] 6.13.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2020-05-15 12:22:27.497444-0400 Example App[23464:8821128] 6.13.0 - [Firebase/Analytics][I-ACS023033] Starting data upload
2020-05-15 12:22:27.501020-0400 Example App[23464:8821128] 6.13.0 - [Firebase/Analytics][I-ACS023105] Event is not subject to real-time event count daily limit. Marking an event as real-time. Event name, parameters: select_content, {
content_type = clothing;
ga_debug (_dbg) = 1;
ga_event_origin (_o) = app;
ga_realtime (_r) = 1;
ga_screen_class (_sc) = UIViewController;
ga_screen_id (_si) = -3307323385789565728;
item_id = abcd;
}
2020-05-15 12:22:27.511485-0400 Example App[23464:8821128] 6.13.0 - [Firebase/Analytics][I-ACS012018] Saving bundle. size (bytes): 499
2020-05-15 12:22:27.512391-0400 Example App[23464:8821128] 6.13.0 - [Firebase/Analytics][I-ACS023116] Bundle added to the upload queue. BundleID, timestamp (ms): 38, 1589559746485
2020-05-15 12:22:27.518879-0400 Example App[23464:8821128] 6.13.0 - [Firebase/Analytics][I-ACS023038] Uploading events. Elapsed time since last successful upload (s): 44.21102094650269
2020-05-15 12:22:27.519180-0400 Example App[23464:8820960] 6.13.0 - [Firebase/Analytics][I-ACS023039] Measurement data sent to network. Timestamp (ms), data: 1589559747518, <APMPBMeasurementBatch: 0x2808513f0>
2020-05-15 12:22:27.524885-0400 Example App[23464:8820960] 6.13.0 - [Firebase/Analytics][I-ACS900000] Uploading data. Host: https://app-measurement.com/a
2020-05-15 12:22:27.607462-0400 Example App[23464:8820960] 6.13.0 - [Firebase/Analytics][I-ACS901006] Received SSL challenge for host. Host: https://app-measurement.com/a
2020-05-15 12:22:27.674761-0400 Example App[23464:8821408] 6.13.0 - [Firebase/Analytics][I-ACS023044] Successful upload. Got network response. Code, size: 204, -1
2020-05-15 12:22:27.679982-0400 Example App[23464:8821408] 6.13.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): -0.1942161321640015
2020-05-15 12:22:27.680071-0400 Example App[23464:8821408] 6.13.0 - [Firebase/Analytics][I-ACS023028] Upload task scheduled to be executed in approx. (s): -0.1942161321640015
2020-05-15 12:22:27.688291-0400 Example App[23464:8821408] 6.13.0 - [Firebase/Analytics][I-ACS023024] No data to upload. Upload task will not be scheduled
2020-05-15 12:22:27.688364-0400 Example App[23464:8821408] 6.13.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
这是我所做的一切:
我修改了我的AppDelegate.m
// imports
#import <Firebase.h> // Imported Firebase.h
// more imports
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
// ... rest of my didFinishLaunchingWithOptions
我将 GoogleService-Info.plist 添加到我的应用目标中。然后我关注了this post 并且:
现在这并不重要,但对于在这个问题上遇到错误的人来说仍然很重要。由于 GoogleServices-Info.plist 文件中的问题,firebase 分析的调试模式有时无法工作只需进行这 2 项更改。
将 IS_ANALYTICS_ENABLED 设置为 YES
将 FIREBASE_ANALYTICS_COLLECTION_DEACTIVATE 设置为 NO
完全删除FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED
然后我从我的 .plist 中删除了 FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED,就像建议的 this post 一样。还是不行。
确保没有像this post 所说的那样启用OS_ACTIVITY_MODE:disable
如果您在某个时候添加了 OS_ACTIVITY_MODE:disable,请确保从项目方案中的环境变量中删除它。
设置环境变量
Podfile.lock 相关部分
- Firebase/Analytics (6.13.0):
- Firebase/Core
- Firebase/Core (6.13.0):
- Firebase/CoreOnly
- FirebaseAnalytics (= 6.1.6)
- Firebase/CoreOnly (6.13.0):
- FirebaseCore (= 6.4.0)
- FirebaseAnalytics (6.1.6):
- FirebaseCore (~> 6.4)
- FirebaseInstanceID (~> 4.2)
- GoogleAppMeasurement (= 6.1.6)
- GoogleUtilities/AppDelegateSwizzler (~> 6.0)
- GoogleUtilities/MethodSwizzler (~> 6.0)
- GoogleUtilities/Network (~> 6.0)
- "GoogleUtilities/NSData+zlib (~> 6.0)"
- nanopb (= 0.3.9011)
- FirebaseCore (6.4.0):
- FirebaseCoreDiagnostics (~> 1.0)
- FirebaseCoreDiagnosticsInterop (~> 1.0)
- GoogleUtilities/Environment (~> 6.2)
- GoogleUtilities/Logger (~> 6.2)
- FirebaseCoreDiagnostics (1.2.4):
- FirebaseCoreDiagnosticsInterop (~> 1.2)
- GoogleDataTransportCCTSupport (~> 3.0)
- GoogleUtilities/Environment (~> 6.5)
- GoogleUtilities/Logger (~> 6.5)
- nanopb (~> 0.3.901)
- FirebaseCoreDiagnosticsInterop (1.2.0)
- FirebaseInstanceID (4.2.7):
- FirebaseCore (~> 6.0)
- GoogleUtilities/Environment (~> 6.0)
- GoogleUtilities/UserDefaults (~> 6.0)
【问题讨论】:
-
嗨,您使用什么模块来为您的 react-native 应用集成 firebase 服务
-
RNFirebase @EL173
-
抱歉,我没有使用 RNFirebase 的经验。但我建议你尽可能用 react-native-firebase 代替 RNFirebase,因为它有很好的文档+社区。 github.com/invertase/react-native-firebase
-
我在同一条船上...调试适用于 android 和 Xcode 控制台我可以像您一样看到 Firebase Analytics 事件正在触发,但它们从未在调试视图中显示:(跨度>
-
@EricWiener ,我以为我遇到的问题和你一模一样。我已经想弄清楚大约 8 个小时了。但仍然没有什么重要的来源。 em .. :( 。这只是反应原生的吗?
标签: ios firebase react-native firebase-analytics react-native-firebase