我想在我的iOS
应用中实现Facebook插播广告
我将 FBInstreamAdView 设置为“ YOUR_PLACEMENT_ID ”。
然后我的应用崩溃了。
我尝试使用它。
import FBAudienceNetwork
var fbInstreamAdView: FBInstreamAdView?
open var fbInstreamPlacementID:String? {
willSet {
// ToDo
}
didSet {
// if I comment this line is work.
fbInstreamAdView = FBInstreamAdView.init(placementID: fbInstreamPlacementID ?? "")
//
}
}
在pod文件中,我也使用googleIMA,因为我有一些视频没有展示来自Facebook的广告。
target 'MyAppPlayer' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Brightcove-Player-Core/dynamic'
pod 'Brightcove-Player-IMA'
pod 'GoogleAds-IMA-iOS-SDK'
pod 'FBAudienceNetwork'
pod 'Alamofire'
pod 'AlamofireImage'
pod 'CryptoSwift' , '~> 0.15.0'
pod 'SwiftyJSON', '~> 4.2.0'
pod 'RealmSwift' #, '~> 2.8.3'
pod 'KDCircularProgress'
pod 'Spring', :git => 'https://github.com/MengTo/Spring.git'
pod 'VisualEffectView' , '~> 3.1.1'
# post_install do |installer|
# installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
# configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
# end
# end
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
end
Xcode控制台中的此错误。
2019-04-30 17:45:37.175508+0700 BBTVBC_Sample[57504:3840076] *** Terminating app due to uncaught exception 'FBFinalClassViolationException', reason: 'FBAdUtility is a final class and cannot be subclassed. FBAdUtility'
*** First throw call stack:
(
0 CoreFoundation 0x00000001118771bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000011786e735 objc_exception_throw + 48
2 BBTVBC_Sample 0x000000010fbadb2e +[FBAdUtility initializeAudienceNetwork] + 0
3 libobjc.A.dylib 0x000000011786f2fe CALLING_SOME_+initialize_METHOD + 19
4 libobjc.A.dylib 0x000000011786f691 _class_initialize + 270
5 libobjc.A.dylib 0x0000000117876248 lookUpImpOrForward + 196
6 libobjc.A.dylib 0x0000000117883814 _objc_msgSend_uncached + 68
7 BBTVBC_Sample 0x000000010fbafd3d -[NSDictionary(FBAdUtility) objectForKeyOrNil:ofClass:] + 271
8 BBTVBC_Sample 0x000000010fbaf42b -[NSDictionary(FBAdUtility) stringForKeyOrNil:] + 76
9 BBTVBCPlayer 0x0000000117334853 __62-[FBAdEventManager sendRequestInternal:withExtraData:onRetry:]_block_invoke.443 + 462
10 libdispatch.dylib 0x0000000118e13595 _dispatch_call_block_and_release + 12
11 libdispatch.dylib 0x0000000118e14602 _dispatch_client_callout + 8
12 libdispatch.dylib 0x0000000118e1bb0b _dispatch_lane_serial_drain + 791
13 libdispatch.dylib 0x0000000118e1c784 _dispatch_lane_invoke + 428
14 libdispatch.dylib 0x0000000118e2689a _dispatch_workloop_worker_thread + 733
15 libsystem_pthread.dylib 0x0000000119204611 _pthread_wqthread + 421
16 libsystem_pthread.dylib 0x00000001192043fd start_wqthread + 13
)
2019-04-30 17:45:37.308791+0700 BBTVBC_Sample[57504:3840104] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C10.1:2][0x7fecce528b70] get output frames failed, state 8196
2019-04-30 17:45:37.308994+0700 BBTVBC_Sample[57504:3840104] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C10.1:2][0x7fecce528b70] get output frames failed, state 8196
2019-04-30 17:45:37.310010+0700 BBTVBC_Sample[57504:3840104] TIC Read Status [10:0x0]: 1:57
2019-04-30 17:45:37.310468+0700 BBTVBC_Sample[57504:3840104] TIC Read Status [10:0x0]: 1:57
libc++abi.dylib: terminating with uncaught exception of type NSException
该如何解决?
谢谢。