我们已升级到FBAudienceNetwork v.4.26,现在,只要我们尝试在Xcode中运行单元测试目标,我们就会看到以下未处理的运行时异常:
2017-10-12 15:30:41.229388-0500 App[60509:1890366] *** Terminating app due to uncaught exception 'FBFinalClassViolationException', reason: 'FBAdTimer is a final class and cannot be subclassed. FBAdTimer'
*** First throw call stack:
(
0 CoreFoundation 0x000000011ca991cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000011c1bef41 objc_exception_throw + 48
2 AppTests 0x00000001399cc669 +[FBAdTimer scheduledTimerWithTimeInterval:repeats:block:] + 0
3 libobjc.A.dylib 0x000000011c1bfa14 CALLING_SOME_+initialize_METHOD + 19
4 libobjc.A.dylib 0x000000011c1bfdae _class_initialize + 276
5 libobjc.A.dylib 0x000000011c1c65e7 lookUpImpOrForward + 225
6 libobjc.A.dylib 0x000000011c1d63d4 _objc_msgSend_uncached + 68
7 AppTests 0x00000001399c8ec4 +[FBAdFingerprinter load] + 46
8 libobjc.A.dylib 0x000000011c1c069b call_load_methods + 695
9 libobjc.A.dylib 0x000000011c1c12f3 load_images + 70
10 ??? 0x000000010ff7adac 0x0 + 4562857388
11 ??? 0x000000010ff876c5 0x0 + 4562908869
12 ??? 0x000000010ff86898 0x0 + 4562905240
13 ??? 0x000000010ff8692c 0x0 + 4562905388
14 ??? 0x000000010ff7d956 0x0 + 4562868566
15 ??? 0x000000010ff83076 0x0 + 4562890870
16 libdyld.dylib 0x000000011ddeba47 dlopen + 86
17 CoreFoundation 0x000000011ca49808 _CFBundleDlfcnLoadBundle + 152
18 CoreFoundation 0x000000011ca49694 _CFBundleLoadExecutableAndReturnError + 324
19 Foundation 0x0000000114060ec1 -[NSBundle loadAndReturnError:] + 520
20 IDEBundleInjection 0x0000000110057860 __XCBundleInjection + 798
21 ??? 0x000000010ff8bc16 0x0 + 4562926614
22 ??? 0x000000010ff8be46 0x0 + 4562927174
23 ??? 0x000000010ff876da 0x0 + 4562908890
24 ??? 0x000000010ff86898 0x0 + 4562905240
25 ??? 0x000000010ff8692c 0x0 + 4562905388
26 ??? 0x000000010ff7b15d 0x0 + 4562858333
27 ??? 0x000000010ff7ec98 0x0 + 4562873496
28 ??? 0x000000010ff7a3d4 0x0 + 4562854868
29 ??? 0x0000000118742510 0x0 + 4705232144
30 ??? 0x0000000118740a39 0x0 + 4705225273
31 ??? 0x000000011873c249 0x0 + 4705206857
32 ??? 0x000000011873c036 0x0 + 4705206326
33 ??? 0x0000000000000007 0x0 + 7
)
libc++abi.dylib: terminating with uncaught exception of type NSException
奇怪的是,在我们的代码库(包括所有第三方依赖项)中,唯一的包含单词" FBAdTimer"是:
λ ~/Projects/iOS/app/ IOS-6370* grep -iR "FBAdTimer" .
Binary file ./Pods/FBAudienceNetwork/FBAudienceNetwork.framework/FBAudienceNetwork matches
Binary file ./App.xcworkspace/xcuserdata/silver.xcuserdatad/UserInterfaceState.xcuserstate matches
答案 0 :(得分:2)
根据https://developers.facebook.com/bugs/147221075773612/,FBAudienceNetwork不能同时位于测试目标和加载它的主要包中。解决方案是从Podfile中删除测试目标的依赖项:
target 'App' do
use_frameworks!
pod 'FBAudienceNetwork' # Only present in the main app target
end
target 'AppTests' do
end
答案 1 :(得分:0)
只是引用我的案例,促使我访问此线程,
我正在创建一个框架来管理 Facebook Audience Network,我在 FacebookAudienceNetwork.framework 包中的不同类上多次遇到 FBFinalClassViolationException
异常
嫌疑人是:appoDeal(是一个中介适配器 sdk),它正在添加 FacebookAudience Network 框架来管理他们的中介适配器。
从 AppoDeal pod 集合中删除 FacebookAudienceNetwork pod 解决了我的问题,(在我的情况下,删除 AppoDeal 没问题)
Hint to Solution:
请检查是否有其他框架/库/sdks 添加了 FacebookAudienceNetwork