Overview
Use the Adrop iOS SDK to display various ad formats in your app.Supported Ad Formats
| Format | Description |
|---|---|
| Banner | Rectangular ads displayed in a portion of the screen |
| Native | Ads that can be customized to match your app UI |
| Interstitial | Full-screen ads that cover the entire screen |
| Rewarded | Video ads that provide rewards upon completion |
| Popup | Ads displayed as popups at specific moments |
| Splash | Ads displayed with your logo when the app starts |
Requirements
- iOS 13.0 or higher
- Xcode 14.1 or higher
- Swift 5.0 or higher
Prerequisites
1. Add adrop_service.json File
1
Download File
Download the
adrop_service.json file from AdControl Console > Admin > App.2
Add to Project
Add the downloaded file to your Xcode project root.
3
Check Targets
When adding the file, ensure that all targets are selected.
2. Check Unit ID
Check the unit ID for your ad placement in the Ad Unit tab of the console.Installation
Swift Package Manager (Recommended)
- In Xcode, select File > Add Package Dependencies…
- Enter the package URL:
- Click Add Package
CocoaPods
- Create Podfile if it doesn’t exist:
- Add to Podfile:
Podfile
- Install:
- Open the project with
.xcworkspacefile
Initialization
Initialize the SDK inapplication(_:didFinishLaunchingWithOptions:) of your AppDelegate.
Initialization Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
production | Bool | false | Production mode. Set to true when deploying |
targetCountries | [String] | [] | List of target country codes (ISO 3166 alpha-2) |
useInAppBrowser | Bool | false | Whether to use in-app browser |
User Configuration
Set UID
Set a user identifier for targeted advertising.Set the UID before entering the ad placement for targeted ads to work properly.
Set Theme
Set the theme for ads that support dark mode. Must be set after callinginitialize().
auto mode automatically detects system dark mode settings. When the theme changes, the splash ad cache is automatically reset.Deep Link Handling
Handle deep links when the app is launched via external links.Test Unit IDs
Use test unit IDs during development. Replace with actual unit IDs before production deployment.Banner Ads
| Format | Test Unit ID |
|---|---|
| Banner (320x50) | PUBLIC_TEST_UNIT_ID_320_50 |
| Banner (320x100) | PUBLIC_TEST_UNIT_ID_320_100 |
| Carousel Banner | PUBLIC_TEST_UNIT_ID_CAROUSEL |
| Banner Video (16:9) | PUBLIC_TEST_UNIT_ID_BANNER_VIDEO_16_9 |
| Banner Video (9:16) | PUBLIC_TEST_UNIT_ID_BANNER_VIDEO_9_16 |
Native Ads
| Format | Test Unit ID |
|---|---|
| Native (Image) | PUBLIC_TEST_UNIT_ID_NATIVE |
| Native Video (16:9) | PUBLIC_TEST_UNIT_ID_NATIVE_VIDEO_16_9 |
| Native Video (9:16) | PUBLIC_TEST_UNIT_ID_NATIVE_VIDEO_9_16 |
Interstitial/Rewarded Ads
| Format | Test Unit ID |
|---|---|
| Interstitial | PUBLIC_TEST_UNIT_ID_INTERSTITIAL |
| Rewarded | PUBLIC_TEST_UNIT_ID_REWARDED |
Popup Ads
| Format | Test Unit ID |
|---|---|
| Popup (Bottom) | PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM |
| Popup (Center) | PUBLIC_TEST_UNIT_ID_POPUP_CENTER |
| Popup Video Bottom (16:9) | PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM_VIDEO_16_9 |
| Popup Video Bottom (9:16) | PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM_VIDEO_9_16 |
| Popup Video Center (16:9) | PUBLIC_TEST_UNIT_ID_POPUP_CENTER_VIDEO_16_9 |
| Popup Video Center (9:16) | PUBLIC_TEST_UNIT_ID_POPUP_CENTER_VIDEO_9_16 |
Splash Ads
| Format | Test Unit ID |
|---|---|
| Splash | PUBLIC_TEST_UNIT_ID_SPLASH |
Error Codes
Main error codes returned when ad loading fails.| Error Code | Description |
|---|---|
ERROR_CODE_AD_NO_FILL | No available ads to display |
ERROR_CODE_NETWORK | Network connection failed |
ERROR_CODE_INVALID_UNIT | Invalid unit ID |
ERROR_CODE_INITIALIZE | SDK initialization required |
Table of Contents
Banner Ads
Implementing banner ads
Native Ads
Implementing native ads
Interstitial Ads
Implementing interstitial ads
Rewarded Ads
Implementing rewarded ads
Popup Ads
Implementing popup ads
Splash Ads
Implementing splash ads
Backfill Ads
Setting up backfill ads
Targeting Settings
User attributes and contextual targeting
Reference
Classes, delegates, error codes
Examples
Example repository