FBFinalClassViolationException:FBAdTimer 是最终类,不能被子类化 [英] FBFinalClassViolationException: FBAdTimer is a final class and cannot be subclassed

查看:73
本文介绍了FBFinalClassViolationException:FBAdTimer 是最终类,不能被子类化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已升级到 FBAudienceNetwork v.4.26,现在每当我们尝试在 Xcode 中运行单元测试目标时,都会看到以下未处理的运行时异常:

We've upgraded to FBAudienceNetwork v.4.26, and now we're seeing the following unhandled runtime exception any time we try to run our unit tests target in 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"这个词的文件是:

Curiously enough, within our codebase (including all the third-party dependencies), the only file that contains the word "FBAdTimer" is:

λ ~/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

推荐答案

根据 https://developer.facebook.com/bugs/147221075773612/,FBAudienceNetwork 不能同时在测试目标和加载它的主包中.解决方法是在 Podfile 中去掉 test 目标的依赖:

According to https://developers.facebook.com/bugs/147221075773612/, FBAudienceNetwork cannot be in both the test target and the main bundle that loads with it. The solution is to remove the dependency from the test target in Podfile:

target 'App' do
  use_frameworks!

  pod 'FBAudienceNetwork'  # Only present in the main app target
end

target 'AppTests' do

end

这篇关于FBFinalClassViolationException:FBAdTimer 是最终类,不能被子类化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆