swift MoPub for iOS:'目标未运行或缺少所需的目标权利'

9gm1akwq  于 2023-09-30  发布在  Swift
关注(0)|答案(1)|浏览(110)

我试图通过iOS 14版MoPub来赚钱,但我的广告没有显示,并且在尝试显示广告时,我在日志中收到以下消息:

Initialized OM SDK version: 1.3.4-Mopub

Attempting to load ad

[assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}>

[ProcessSuspension] 0x10b0b8bc0 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 18829, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}

SDK initialized and ready to display ads.
    Initialized adapters:
    No adapters initialized

Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service

Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service

在我的AppDelegateapplication(_: didFinishLaunchingWithOptions:)函数中,我有以下内容:

let sdkConfig = MPMoPubConfiguration(adUnitIdForAppInitialization: "TestAdUnitID")
sdkConfig.loggingLevel = .info
MoPub.sharedInstance().initializeSdk(with: sdkConfig, completion:{
   GameViewController().showAd()
})

我有一个遵循MPAdViewDelegate协议的视图控制器,并在SDK完成初始化后加载广告:

self.moPubBannerView = MPAdView.init(adUnitId: "TestAdUnitID")
let adSize = kMPPresetMaxAdSize50Height
let bounds = view.bounds
var adFrame = CGRect.zero
adFrame.size = CGSize(width: 320, height: 50)
adFrame.origin.x = (bounds.size.width-adFrame.size.width)/2
adFrame.origin.y = bounds.size.height - adFrame.size.height

self.moPubBannerView?.frame = adFrame
self.moPubBannerView?.maxAdSize = adSize
self.moPubBannerView?.delegate = self
self.view.addSubview(self.moPubBannerView!)
self.moPubBannerView?.loadAd()

我在info.plist中设置了Privacy - Tracking Usage Description。我在一个真实的设备上测试,使用正确的MoPub SDK。
你知道是什么导致了这个错误,以及如何修复它吗?谢谢您的帮助!

**编辑:最初,我手动集成了MoPub SDK-但我也尝试使用可可pod进行集成,并收到了相同的错误/问题。
编辑#2:MoPub对我的支持请求的回应是告诉我需要包括一项权利,
但没有告诉我需要哪项权利。
因此,我知道我缺少一项权利,我只需要知道是哪一项权利。
**编辑#3:**我尝试了不同的广告提供商的框架,遇到了同样的错误。所以这肯定是我的问题不是MoPub的我尝试启用Access WiFi Information功能(并确认它已添加到我的App.entitlements),我还将App Transport Security Settings-> Allow Arbitrary Loads添加到我的Info.plist。但问题依然存在。

lhcgjxsq

lhcgjxsq1#

我认为缺少的权利可能是此行中的Background per domain:"com.apple.webkit" name:"Background"

[assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}>

Xcode 15:

相关问题