我在iOS 11(xcode 9)上不断收到这些警告:

=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 988, TID: 338692, Thread name: fnf player thread, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4   hairzapp                            0x0000000103a35634 -[FNFPlayerLayer _preventPlayback] + 60
5   hairzapp                            0x0000000103a33f30 -[FNFPlayerLayer _resetGLContext] + 36
6   hairzapp                            0x0000000103a129cc __35-[FNFRenderingThread dispatchSync:]_block_invoke + 28
7   hairzapp                            0x0000000103a128a8 __35-[FNFRenderingThread performBlock:]_block_invoke + 36
8   CoreFoundation                      0x00000001848fa0fc <redacted> + 20
9   CoreFoundation                      0x00000001848f99cc <redacted> + 288
10  CoreFoundation                      0x00000001848f7c34 <redacted> + 2436
11  CoreFoundation                      0x0000000184817fb8 CFRunLoopRunSpecific + 436
12  CoreFoundation                      0x0000000184867098 CFRunLoopRun + 116
13  hairzapp                            0x0000000103a12ba4 -[FNFRenderingThread main] + 204
14  Foundation                          0x0000000185342860 <redacted> + 996
15  libsystem_pthread.dylib             0x000000018457c31c <redacted> + 308
16  libsystem_pthread.dylib             0x000000018457c1e8 <redacted> + 0
17  libsystem_pthread.dylib             0x000000018457ac28 thread_start + 4
2017-11-28 22:33:33.895582+0100 hairzapp[988:338692] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 988, TID: 338692, Thread name: fnf player thread, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4   hairzapp                            0x0000000103a35634 -[FNFPlayerLayer _preventPlayback] + 60
5   hairzapp                            0x0000000103a33f30 -[FNFPlayerLayer _resetGLContext] + 36
6   hairzapp                            0x0000000103a129cc __35-[FNFRenderingThread dispatchSync:]_block_invoke + 28
7   hairzapp                            0x0000000103a128a8 __35-[FNFRenderingThread performBlock:]_block_invoke + 36
8   CoreFoundation                      0x00000001848fa0fc <redacted> + 20
9   CoreFoundation                      0x00000001848f99cc <redacted> + 288
10  CoreFoundation                      0x00000001848f7c34 <redacted> + 2436
11  CoreFoundation                      0x0000000184817fb8 CFRunLoopRunSpecific + 436
12  CoreFoundation                      0x0000000184867098 CFRunLoopRun + 116
13  hairzapp                            0x0000000103a12ba4 -[FNFRenderingThread main] + 204
14  Foundation                          0x0000000185342860 <redacted> + 996
15  libsystem_pthread.dylib             0x000000018457c31c <redacted> + 308
16  libsystem_pthread.dylib             0x000000018457c1e8 <redacted> + 0
17  libsystem_pthread.dylib             0x000000018457ac28 thread_start + 4

您能帮我找到来源吗?我猜它一定是我使用的库之一,因为在我的代码中对[UIApplication applicationState]的调用很少:
pod 'objective-zip', '1.0.3'
pod 'Google-Mobile-Ads-SDK'
pod 'AppLovinSDK'
pod 'AdColony'
pod 'GoogleMobileAdsMediationAppLovin'
pod 'GoogleMobileAdsMediationAdColony'
pod 'GoogleAnalytics'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
pod 'FBAudienceNetwork', '4.25.0'
pod 'GoogleConversionTracking'
pod 'Fabric'
pod 'Crashlytics'
pod 'AFNetworking'
pod 'AFNetworkActivityLogger', :git => 'https://github.com/AFNetworking/AFNetworkActivityLogger.git', :branch => '3_0_0'
pod 'iRate'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'MBProgressHUD'
pod 'Realm'
pod 'UICollectionViewLeftAlignedLayout'
pod 'OpenCV'
pod 'SCLAlertView-Objective-C'
pod 'CMPopTipView'

如果有人可以给我提示如何找到错误的库,我将感到非常高兴。

最佳答案

我猜它有Facebook SDK根。
Instagramm上找到了GitHub类转储,看起来像一些 private 类。
https://github.com/RishabSwift/InstagramHeaders/blob/master/FNFPlayerLayer.h

- (_Bool)_preventPlayback;

还可以在此处找到FNFPlayerLayer“面包屑”:
https://github.com/facebook/infer/blob/master/infer/tests/codetoanalyze/objc/ioslints/unavailable_property_ios.m

它可能来自FBAudienceNetwork框架,您可以尝试将其从Podfile中删除,然后制作pod install并再次分析控制台日志。

关于ios - 什么是FNFPlayer?它从后台线程访问UIApplication applicationState,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47541444/

10-12 18:08