Skip to content

iOS SDK - API reference

Classes, members and errors of the MDN11 iOS SDK.

SDK

A11

The SDK entry point: initialization, ad unit access, test mode, logging and debug tools.

Member Description
A11.shared: A11 Shared SDK instance.
A11.privacy: A11.Privacy Privacy signal setters.
A11.publisherSignals: A11.PublisherSignals Publisher signal setters.
shared.initialize(appKey:hostURLs:) Initialize the SDK. Call once. hostURLs defines an ordered list of config endpoints - the SDK uses the first one that responds successfully, falling back to the next if one fails.
shared.initialize(appKey:staticConfig:) Initialize with a publisher-provided JSON config string, skipping the remote fetch. Use when no backend endpoint is available or for offline environments.
shared.initialize(appKey:hostURLs:staticConfig:) Hybrid initialization: the SDK becomes usable immediately from staticConfig, while a remote config is fetched from hostURLs in the background and applied when it arrives.
shared.setDevelopmentMode(enabled:) Enable verbose logging. Must call before initialize().
shared.setTestAds(enabled:) Enable test creatives. Must call before initialize().
shared.sdkVersion: String Current SDK version.
shared.disableUncaughtExceptionHandling() Disables uncaught exception handling on all ad network providers.
shared.getBannerAd(adUnitID:): BannerAd Returns a cached banner ad instance.
shared.getMRECAd(adUnitID:): MRECAd Returns a cached MREC ad instance.
shared.getInterstitialAd(adUnitID:): InterstitialAd Returns a cached interstitial ad instance.
shared.getRewardedAd(adUnitID:): RewardedAd Returns a cached rewarded ad instance.
shared.presentDebugMenu(on:) Shows the mediation debug view. Call after initialize().
shared.addLogger(_:) Adds a logger to receive SDK log messages.
shared.removeLogger(_:) Removes a previously added logger.

A11.Privacy

Accessed through A11.privacy.

Method Description
setUserConsent(_:) GDPR / LGPD consent per vendor. Can be updated during session.
setDoNotSell(_:) CCPA opt-out signal. Can be updated during session.
setIsChildDirected(_:) COPPA flag. Must set before initialize(), cannot change after.

For a full list of which networks require direct publisher action on privacy, see the Network privacy reference.

A11.PublisherSignals

Accessed through A11.publisherSignals.

Method Description
setIsPaidUser(_:) Whether the user has made a purchase.
setInstalledApps(_:) Bundle IDs of other publisher apps on the device.
setUserID(_:) Publisher-defined user ID.

Ad formats

BannerAd

Returned by A11.shared.getBannerAd(adUnitID:).

Member Description
delegate: BannerAdDelegate? Callback delegate.
bestLoadedAdListener: BestLoadedAdListener? Notified on the main thread when the best loaded ad for this ad unit changes. Held weakly - see Best loaded ad.
bestLoadedAd: AdInfo? Snapshot of the best loaded ad, or nil if none.
adView: UIView Banner view to add to your hierarchy. Always exists; holds the ad after show(on:).
adSize: BannerAdSize Banner size. Default .adaptive. Set before load(on:). See Banner sizes.
customParameters: [String: Any]? Optional network-specific key-value pairs forwarded to supporting adapters. Set before load(on:).
load(on:) Start loading a banner ad.
show(on:) Start rendering and impression tracking.
notifyLossToExternal(price:) Report that an impression for this ad unit went to an ad source outside the SDK. price is the eCPM as Decimal?; call notifyLossToExternal() when unknown. See External loss reporting.

MRECAd

Returned by A11.shared.getMRECAd(adUnitID:).

Member Description
delegate: MRECAdDelegate? Callback delegate.
bestLoadedAdListener: BestLoadedAdListener? Notified on the main thread when the best loaded ad for this ad unit changes. Held weakly - see Best loaded ad.
bestLoadedAd: AdInfo? Snapshot of the best loaded ad, or nil if none.
adView: UIView MREC view to add to your hierarchy. Always exists; holds the ad after show(on:).
customParameters: [String: Any]? Optional network-specific key-value pairs forwarded to supporting adapters. Set before load(on:).
load(on:) Start loading a MREC ad.
show(on:) Start rendering and impression tracking.
notifyLossToExternal(price:) Report that an impression for this ad unit went to an ad source outside the SDK. price is the eCPM as Decimal?; call notifyLossToExternal() when unknown. See External loss reporting.

InterstitialAd

Returned by A11.shared.getInterstitialAd(adUnitID:).

Member Description
delegate: InterstitialAdDelegate? Callback delegate.
bestLoadedAdListener: BestLoadedAdListener? Notified on the main thread when the best loaded ad for this ad unit changes. Held weakly - see Best loaded ad.
bestLoadedAd: AdInfo? Snapshot of the best loaded ad, or nil if none.
customParameters: [String: Any]? Optional network-specific key-value pairs forwarded to supporting adapters. Set before load(on:).
load(on:) Load an ad.
show(on:) Present the interstitial.
notifyLossToExternal(price:) Report that an impression for this ad unit went to an ad source outside the SDK. price is the eCPM as Decimal?; call notifyLossToExternal() when unknown. See External loss reporting.

RewardedAd

Returned by A11.shared.getRewardedAd(adUnitID:).

Member Description
delegate: RewardedAdDelegate? Callback delegate.
bestLoadedAdListener: BestLoadedAdListener? Notified on the main thread when the best loaded ad for this ad unit changes. Held weakly - see Best loaded ad.
bestLoadedAd: AdInfo? Snapshot of the best loaded ad, or nil if none.
customParameters: [String: Any]? Optional network-specific key-value pairs forwarded to supporting adapters. Set before load(on:).
load(on:) Load an ad.
show(on:) Present the rewarded ad.
notifyLossToExternal(price:) Report that an impression for this ad unit went to an ad source outside the SDK. price is the eCPM as Decimal?; call notifyLossToExternal() when unknown. See External loss reporting.

Ad data

AdInfo

Field Type Description
adUnitID String MDN11 ad unit.
adCallID String Unique ID for this ad call.
sdkAdapter String Name of the SDK adapter that served the ad.
sdkPlacementID String? sdkAdapter's own placement id (e.g. an AdMob ad unit id, an AppLovin zone id) - nil when the adapter exposes none.
adNetworkName String? Name of the ad network that served the ad.
adImpressionValue AdInfo.AdImpressionValue? Impression valuation data, if available.
extraParameters [String: Any]? Adapter-specific load-response data, keyed by network (e.g. "google_admob" with fields from AdMob's ResponseInfo, including the mediation group id) - nil when the adapter provides none.

AdInfo.AdImpressionValue

Field Type Description
value Decimal Monetary value of the impression.
valuationMethod ValuationMethod Precision of the value: .precise, .estimated, .provided, .unknown.
currency String? Currency code for value.

BestLoadedAdListener

Class-bound protocol. See Best loaded ad for full semantics.

Member Description
onBestLoadedAdChanged(adInfo: AdInfo?) Called on the main thread when the best loaded ad for the ad unit changes. nil when none is currently held.

Errors

Load errors

Error Meaning
wrongAppKey App key is invalid.
missingConfig No waterfall configuration returned. initialize() must be called first.
invalidAdUnit Ad unit ID does not exist in the configuration.
missingSelectors Missing selectors in configuration.
missingAdapters Missing adapters in configuration.
noFill No network returned an ad. Retry with backoff.
noNetwork Device has no internet connection.
networkError Network or server error.
timeout Ad request timed out.
other Unclassified error.

Show errors

Error Meaning
adNotReady show() called before ad finished loading.
adExpired Ad was loaded too long ago - reload before showing.
other Unclassified error.