ios - 无法在 Swift 中使用 Xcode 9 消除 Firebase Analytics 线程警告

标签 ios swift firebase firebase-analytics xcode9

使用现有项目迁移到 Xcode 9 后,我不断收到来自主线程检查器的关于名为 FIRAnalyticsQueue 的队列的警告。 我发现这个 MTC 是一项很棒的功能,因为我已经用它解决了很多线程问题,但不幸的是我无法消除与 Firebase 配置有关的问题。

我在 AppDelegate didFinishLaunchingWithOptions 函数中使用的代码如下:

if FIRApp.defaultApp() == nil {
   FIRApp.configure()
}

以及我在评估上述代码后收到的日志:

2017-10-05 16:14:34.965 PonySugarCandyApp[17721] <Error> [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure] to your application initialization.
2017-10-05 16:14:45.283 PonySugarCandyApp[17721] <Notice> [Firebase/Analytics][I-ACS023007] Firebase Analytics v.3700000 started
2017-10-05 16:14:52.139 PonySugarCandyApp[17721] <Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 17721, TID: 1309471, Thread name: (none), Queue name: FIRAnalyticsQueue, QoS: 9
Backtrace:
4   PonySugarCandyApp                   0x000000010c5fe721 __38+[FIRAnalytics createAppDelegateProxy]_block_invoke + 55
5   libdispatch.dylib                   0x000000011337143c _dispatch_client_callout + 8
6   libdispatch.dylib                   0x00000001133729c7 dispatch_once_f + 297
7   PonySugarCandyApp                   0x000000010c5fd519 __47+[FIRAnalytics startWithConfiguration:options:]_block_invoke_2 + 101
8   libdispatch.dylib                   0x00000001133703f7 _dispatch_call_block_and_release + 12
9   libdispatch.dylib                   0x000000011337143c _dispatch_client_callout + 8
10  libdispatch.dylib                   0x000000011337995b _dispatch_queue_serial_drain + 1162
11  libdispatch.dylib                   0x000000011337a2df _dispatch_queue_invoke + 336
12  libdispatch.dylib                   0x000000011337d1f9 _dispatch_root_queue_drain + 772
13  libdispatch.dylib                   0x000000011337ce97 _dispatch_worker_thread3 + 132
14  libsystem_pthread.dylib             0x00000001138345a2 _pthread_wqthread + 1299
15  libsystem_pthread.dylib             0x000000011383407d start_wqthread + 13
(Recorded stack frame) 

最佳答案

最新版本的 Firebase 中已修复此问题。执行 pod update 以升级到 Firebase 4.3.0。有关该问题和修复的更多详细信息,请访问 https://github.com/firebase/firebase-ios-sdk/issues/69 .

关于ios - 无法在 Swift 中使用 Xcode 9 消除 Firebase Analytics 线程警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46588133/

相关文章:

objective-c - 如何阻止 UIScrollView 吞咽触摸

core-data - 快速从 TableView 中删除项目时出错

android - 无法使用Firebase性能进行编译。 (无法找到方法...)

php - 我如何将 firebase 身份验证添加到 laravel api 路由

ios - 如何动画更改按钮标题?

iphone - 去除粉刺/软化图像/用周围像素替换图像像素

ios - viewDidLoad() 中的 addSubView() 和 BringSubViewToFront() 不起作用

ios - swift 错误 : value of optional type 'Double?' not unwrapped

swift - Swift 中的公共(public)扩展 : Float vs Float. 类型

node.js - 允许用户仅在 firebase 上修改自己的数据