分析功能已禁用。未记录事件

时间:2019-01-02 09:27:45

标签: ios xcode firebase google-analytics firebase-analytics

我将Firebase可靠地集成到了我的iOS项目中,但是在记录事件时遇到了麻烦。自动屏幕记录工作正常(ViewControllers在控制台中显示),但是我无法手动记录事件:

Analytics.logEvent("test", parameters: nil)

我在调试控制台中收到以下消息:

  

[Firebase / Analytics] [I-ACS023049]分析已禁用。事件未记录

我的.plist文件直接来自Firebase(未经修改),并且Firebase配置报告以下内容:

  

2019-01-02 10:18:02.532838 + 0100 CLCarRental [90575:9644609] 5.12.0-   [Firebase / Analytics] [I-ACS023007] Analytics(分析)v.50300000版开始   CLCarRental [90575:9644609] 5.12.0-[Firebase / Analytics] [I-ACS023009]   启用调试日志记录2019-01-02 10:18:02.535368 + 0100   CLCarRental [90575:9644609] 5.12.0-[Firebase / Analytics] [I-ACS023013]   禁用了分析功能 2019-01-02 10:18:02.537685 + 0100   CLCarRental [90575:9644393]可达性标志状态:-R -------   networkStatusForFlags 2019-01-02 10:18:02.624924 + 0100   CLCarRental [90575:9644606] [答案]启用了以下设置的答案:

{
"flush_interval_secs" = 300;
"flush_on_background" = 1;
"forward_to_google_analytics" = 0;
"include_purchase_events_in_forwarded_events" = 0;
"max_byte_size_per_file" = 8000;
"max_file_count_per_send" = 1;
"max_pending_send_file_count" = 100;
"sampling_rate" = 1;
"track_custom_events" = 1;
"track_predefined_events" = 1;
"track_view_controllers" = 0;
url = "https://e.crashlytics.com/spi/v2/events"; }

2 个答案:

答案 0 :(得分:2)

我找到了问题的根源。我必须在Xcode中设置以下命令(调用Firebase.configure()后):

AnalyticsConfiguration.shared().setAnalyticsCollectionEnabled(true)

答案 1 :(得分:1)

将这些行添加到您的Info.plist

<key>FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED</key>
<string>NO</string>
<key>FIREBASE_ANALYTICS_COLLECTION_ENABLED</key>
<string>YES</string>