I'm trying to monetize my app with MoPub for iOS 14, but my ad is not being shown and I get the following messages in the logs when trying to display an ad:
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
In my AppDelegate
's application(_: didFinishLaunchingWithOptions:)
function, I have the following:
let sdkConfig = MPMoPubConfiguration(adUnitIdForAppInitialization: "TestAdUnitID")
sdkConfig.loggingLevel = .info
MoPub.sharedInstance().initializeSdk(with: sdkConfig, completion:{
GameViewController().showAd()
})
I have a view controller that adheres to the MPAdViewDelegate
protocol and loads the ad like this, after the SDK has finished initializing:
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()
I have set Privacy - Tracking Usage Description
in my info.plist
. I'm testing on a real device, using the correct MoPub SDK.
Any idea what could be causing this error, and how to fix it? Thank you for your help!
EDIT: Initially, I had integrated the MoPub SDK manually -- but I tried integrating using cocoa pods, too, and received the same errors/problems.
EDIT #2: MoPub responded to my support request by telling me that I need to include an entitlement, without telling me which entitlement I need. So, I know I'm missing an entitlement, I just need to know which one.
EDIT #3:
I tried a different advertisement provider's framework and ran into the same error. So, it must be my problem -- not MoPub's. I tried enabling the Access WiFi Information
capability (and confirmed that it was added to my App.entitlements
) and I also added App Transport Security Settings
-> Allow Arbitrary Loads
to my Info.plist
. But the problem remains.