Skip to main content

Overview

Splash ads are displayed on the splash screen when the app launches. The ad appears alongside your app logo, providing a natural user experience.

Features

  • Natural ad exposure at app launch
  • Maintains brand image with app logo
  • Fixed size of 360px x 270px
  • Supports image and video ads
Use the test unit ID in development: PUBLIC_TEST_UNIT_ID_SPLASH

Ad Size

Splash ads use a fixed size:
  • Size: 360px x 270px (width x height)
  • The ad is displayed at the bottom of the screen, with the app logo placed at the top

Implementation Methods

Splash ads can be implemented in three ways depending on your app’s requirements:
  1. Using AdropSplashAdViewController - The simplest method
  2. Using AdropSplashAdView - Custom splash screen composition
  3. SwiftUI Implementation - For SwiftUI apps

Method 1: Using AdropSplashAdViewController

The simplest implementation method. AdropSplashAdViewController automatically manages the splash screen.

UIKit Implementation

import AdropAds

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        // Initialize Adrop SDK
        Adrop.initialize(production: false)

        return true
    }
}

Displaying Splash Ad in SceneDelegate

import UIKit
import AdropAds

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    var window: UIWindow?

    func scene(
        _ scene: UIScene,
        willConnectTo session: UISceneSession,
        options connectionOptions: UIScene.ConnectionOptions
    ) {
        guard let windowScene = (scene as? UIWindowScene) else { return }

        // Set up window
        window = UIWindow(windowScene: windowScene)

        // Create splash ad view controller
        let splashViewController = AdropSplashAdViewController(
            unitId: "YOUR_SPLASH_UNIT_ID",
            logoImage: UIImage(named: "app_logo")  // App logo image
        )
        splashViewController.delegate = self

        // Set display duration (optional, default is 5 seconds)
        splashViewController.displayDuration = 3.0

        // Set splash screen as root
        window?.rootViewController = splashViewController
        window?.makeKeyAndVisible()
    }
}

Initialization Parameters

ParameterTypeDescription
unitIdStringUnit ID created in the Ad Control console
logoImageUIImage?App logo image. Displayed without logo if nil
displayDurationTimeIntervalAd display duration (seconds). Default is 5.0

Delegate Implementation

// MARK: - AdropSplashAdDelegate
extension SceneDelegate: AdropSplashAdDelegate {
    // Splash ad closed (required)
    func onAdClose(impressed: Bool) {
        print("Splash ad closed - Impressed: \(impressed)")

        // Transition to main screen
        let mainViewController = MainViewController()
        window?.rootViewController = mainViewController
    }

    // Ad received successfully (optional)
    func onAdReceived(_ ad: AdropSplashAd) {
        print("Splash ad received successfully")
    }

    // Ad failed to receive (optional)
    func onAdFailedToReceive(_ ad: AdropSplashAd, _ errorCode: AdropErrorCode) {
        print("Splash ad failed to receive: \(errorCode)")
        // Transitions to main screen even on ad failure
    }

    // Ad impression (optional)
    func onAdImpression(_ ad: AdropSplashAd) {
        print("Splash ad impression")
    }
}
AdropSplashAdViewController automatically handles ad loading, display, and timer management. Even if the ad fails to load, onAdClose is automatically called to transition to the main screen.

Integrating with LaunchScreen

The system LaunchScreen is displayed first before showing the splash ad. For a natural user experience, it’s recommended to match the style of the LaunchScreen with the splash ad screen.

LaunchScreen.storyboard Setup

  1. Open LaunchScreen.storyboard and set the background color to match the splash ad screen
  2. Place the app logo in the center (matching the logo position of the splash ad)
  3. Verify that UILaunchStoryboardName is set to LaunchScreen in Info.plist
Info.plist
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
When the background color and logo position of the LaunchScreen match the splash ad screen, a smooth transition is possible at app launch.

Method 2: Using AdropSplashAdView

Use this when you want to compose a custom splash screen.
import UIKit
import AdropAds

class CustomSplashViewController: UIViewController {
    private var splashAd: AdropSplashAd?
    private let splashAdView = AdropSplashAdView()
    private let logoImageView = UIImageView()

    override func viewDidLoad() {
        super.viewDidLoad()
        setupUI()
        loadSplashAd()
    }

    private func setupUI() {
        view.backgroundColor = .white

        // Set up app logo
        logoImageView.image = UIImage(named: "app_logo")
        logoImageView.contentMode = .scaleAspectFit
        logoImageView.translatesAutoresizingMaskIntoConstraints = false
        view.addSubview(logoImageView)

        // Set up splash ad view
        splashAdView.translatesAutoresizingMaskIntoConstraints = false
        view.addSubview(splashAdView)

        NSLayoutConstraint.activate([
            // Logo: center top of screen
            logoImageView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
            logoImageView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 100),
            logoImageView.widthAnchor.constraint(equalToConstant: 200),
            logoImageView.heightAnchor.constraint(equalToConstant: 200),

            // Ad: bottom of screen
            splashAdView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
            splashAdView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
            splashAdView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
            splashAdView.heightAnchor.constraint(equalToConstant: 270)  // Fixed height
        ])
    }

    private func loadSplashAd() {
        splashAd = AdropSplashAd(unitId: "YOUR_SPLASH_UNIT_ID")
        splashAd?.delegate = self

        // Set up ad view
        splashAdView.delegate = self

        // Load and display ad
        splashAd?.load(splashAdView)
    }
}

// MARK: - AdropSplashAdDelegate
extension CustomSplashViewController: AdropSplashAdDelegate {
    func onAdReceived(_ ad: AdropSplashAd) {
        print("Splash ad received successfully")
    }

    func onAdFailedToReceive(_ ad: AdropSplashAd, _ errorCode: AdropErrorCode) {
        print("Splash ad failed to receive: \(errorCode)")
        // Transition to main screen on failure
        transitionToMainScreen(impressed: false)
    }

    func onAdImpression(_ ad: AdropSplashAd) {
        print("Splash ad impression")
    }
}

// MARK: - AdropSplashAdViewDelegate
extension CustomSplashViewController: AdropSplashAdViewDelegate {
    // Splash ad closed (required)
    func onAdClose(impressed: Bool) {
        print("Splash ad closed - Impressed: \(impressed)")
        transitionToMainScreen(impressed: impressed)
    }

    // Ad received successfully (optional)
    func onAdReceived(_ ad: AdropSplashAd) {
        print("Splash ad view received successfully")
    }

    // Ad failed to receive (optional)
    func onAdFailedToReceive(_ ad: AdropSplashAd, _ errorCode: AdropErrorCode) {
        print("Splash ad view failed to receive: \(errorCode)")
    }

    // Ad impression (optional)
    func onAdImpression(_ ad: AdropSplashAd) {
        print("Splash ad view impression")
    }
}

// MARK: - Navigation
extension CustomSplashViewController {
    private func transitionToMainScreen(impressed: Bool) {
        guard let window = view.window else { return }

        let mainViewController = MainViewController()
        window.rootViewController = mainViewController

        // Smooth transition animation
        UIView.transition(
            with: window,
            duration: 0.3,
            options: .transitionCrossDissolve,
            animations: nil,
            completion: nil
        )
    }
}
When using AdropSplashAdView, you must implement AdropSplashAdViewDelegate. The onAdClose(impressed:) method is required.

Method 3: SwiftUI Implementation

How to implement splash ads in a SwiftUI app.

SwiftUI Wrapper

import SwiftUI
import AdropAds

struct SplashAdView: UIViewControllerRepresentable {
    let unitId: String
    let logoImage: UIImage?
    @Binding var isPresented: Bool

    func makeUIViewController(context: Context) -> AdropSplashAdViewController {
        let controller = AdropSplashAdViewController(
            unitId: unitId,
            logoImage: logoImage
        )
        controller.delegate = context.coordinator
        return controller
    }

    func updateUIViewController(_ uiViewController: AdropSplashAdViewController, context: Context) {
        // No update needed
    }

    func makeCoordinator() -> Coordinator {
        Coordinator(isPresented: $isPresented)
    }

    class Coordinator: NSObject, AdropSplashAdDelegate {
        @Binding var isPresented: Bool

        init(isPresented: Binding<Bool>) {
            _isPresented = isPresented
        }

        func onAdClose(impressed: Bool) {
            print("Splash ad closed - Impressed: \(impressed)")
            DispatchQueue.main.async {
                self.isPresented = false
            }
        }

        func onAdReceived(_ ad: AdropSplashAd) {
            print("Splash ad received successfully")
        }

        func onAdFailedToReceive(_ ad: AdropSplashAd, _ errorCode: AdropErrorCode) {
            print("Splash ad failed to receive: \(errorCode)")
        }

        func onAdImpression(_ ad: AdropSplashAd) {
            print("Splash ad impression")
        }
    }
}

Using in SwiftUI App

import SwiftUI
import AdropAds

@main
struct MyApp: App {
    init() {
        // Initialize SDK
        Adrop.initialize(production: false)
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

struct ContentView: View {
    @State private var showSplash = true

    var body: some View {
        ZStack {
            if showSplash {
                SplashAdView(
                    unitId: "YOUR_SPLASH_UNIT_ID",
                    logoImage: UIImage(named: "app_logo"),
                    isPresented: $showSplash
                )
                .ignoresSafeArea()
            } else {
                MainView()
            }
        }
    }
}

struct MainView: View {
    var body: some View {
        NavigationView {
            VStack {
                Text("Main Screen")
                    .font(.largeTitle)
            }
            .navigationTitle("Home")
        }
    }
}

Delegate Methods

AdropSplashAdDelegate

Delegate for using AdropSplashAd.
MethodRequiredDescription
onAdClose(impressed:)OptionalCalled when splash ad closes. Check ad impression with impressed parameter
onAdReceived(_:)OptionalCalled when ad is received successfully
onAdFailedToReceive(_:_:)OptionalCalled when ad fails to receive
onAdImpression(_:)OptionalCalled when ad impression is recorded

AdropSplashAdViewDelegate

Delegate for using AdropSplashAdView.
MethodRequiredDescription
onAdClose(impressed:)RequiredCalled when splash ad closes. Must handle main screen transition
onAdReceived(_:)OptionalCalled when ad is received successfully
onAdFailedToReceive(_:_:)OptionalCalled when ad fails to receive
onAdImpression(_:)OptionalCalled when ad impression is recorded

The impressed Parameter

The impressed parameter in the onAdClose(impressed:) method indicates whether the ad was actually displayed to the user.
func onAdClose(impressed: Bool) {
    if impressed {
        print("Ad was displayed to the user")
        // Post-impression logic
    } else {
        print("Ad was not displayed (load failure or skipped)")
        // No-impression logic
    }

    // Transition to main screen
    transitionToMainScreen()
}

When impressed is false

  • Ad load failure
  • Network error
  • User skipped before seeing the ad
  • No ad inventory

Best Practices

1. Appropriate Timer Settings

Splash ads should not be displayed too short or too long.
// AdropSplashAdViewController automatically manages the timer
// Default: 5 seconds (including ad load time)

2. Optimize Logo Image

Prepare the app logo in an appropriate size to minimize loading time.
// Recommended logo size: 200x200 ~ 300x300 points
let logoImage = UIImage(named: "app_logo")  // Prepare @2x, @3x versions

3. Handle Failures

Ensure the app starts normally even when ad loading fails.
func onAdFailedToReceive(_ ad: AdropSplashAd, _ errorCode: AdropErrorCode) {
    print("Ad load failed: \(errorCode)")
    // Transition to main screen even on failure
    // AdropSplashAdViewController handles this automatically
}

4. Smooth Screen Transitions

Use natural animations when transitioning to the main screen.
private func transitionToMainScreen() {
    guard let window = view.window else { return }

    let mainViewController = MainViewController()

    UIView.transition(
        with: window,
        duration: 0.3,
        options: .transitionCrossDissolve,
        animations: {
            window.rootViewController = mainViewController
        },
        completion: nil
    )
}

5. Separate Test and Production Environments

Test with separate development and production environments.
#if DEBUG
let splashUnitId = "PUBLIC_TEST_UNIT_ID_SPLASH"
let isProduction = false
#else
let splashUnitId = "YOUR_PRODUCTION_SPLASH_UNIT_ID"
let isProduction = true
#endif

// Initialize SDK
Adrop.initialize(production: isProduction)

// Create splash ad
let splashViewController = AdropSplashAdViewController(
    unitId: splashUnitId,
    logoImage: UIImage(named: "app_logo")
)

Complete SceneDelegate Example

import UIKit
import AdropAds

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    var window: UIWindow?

    func scene(
        _ scene: UIScene,
        willConnectTo session: UISceneSession,
        options connectionOptions: UIScene.ConnectionOptions
    ) {
        guard let windowScene = (scene as? UIWindowScene) else { return }

        // Set up window
        window = UIWindow(windowScene: windowScene)

        #if DEBUG
        let splashUnitId = "PUBLIC_TEST_UNIT_ID_SPLASH"
        #else
        let splashUnitId = "YOUR_PRODUCTION_SPLASH_UNIT_ID"
        #endif

        // Create splash ad view controller
        let splashViewController = AdropSplashAdViewController(
            unitId: splashUnitId,
            logoImage: UIImage(named: "app_logo")
        )
        splashViewController.delegate = self

        // Set root view controller
        window?.rootViewController = splashViewController
        window?.makeKeyAndVisible()
    }
}

// MARK: - AdropSplashAdDelegate
extension SceneDelegate: AdropSplashAdDelegate {
    func onAdClose(impressed: Bool) {
        print("Splash ad closed - Impressed: \(impressed)")

        // Transition to main screen
        let mainViewController = MainViewController()
        let navigationController = UINavigationController(rootViewController: mainViewController)

        guard let window = window else { return }

        UIView.transition(
            with: window,
            duration: 0.3,
            options: .transitionCrossDissolve,
            animations: {
                window.rootViewController = navigationController
            },
            completion: nil
        )
    }

    func onAdReceived(_ ad: AdropSplashAd) {
        print("Splash ad received successfully")
    }

    func onAdFailedToReceive(_ ad: AdropSplashAd, _ errorCode: AdropErrorCode) {
        print("Splash ad failed to receive: \(errorCode)")
        // AdropSplashAdViewController automatically calls onAdClose
    }

    func onAdImpression(_ ad: AdropSplashAd) {
        print("Splash ad impression recorded")
    }
}

Testing

Test Unit ID

Use the test unit ID during development.
// Test unit ID
let testUnitId = "PUBLIC_TEST_UNIT_ID_SPLASH"

// Or use AdropUnitId
let testUnitId = AdropUnitId.PUBLIC_TEST_UNIT_ID_SPLASH
Make sure to use the actual unit ID created in the Ad Control console for production releases. No ad revenue is generated with test unit IDs.

Debugging

Check ad events with logs.
extension SceneDelegate: AdropSplashAdDelegate {
    func onAdReceived(_ ad: AdropSplashAd) {
        #if DEBUG
        print("Splash ad received")
        #endif
    }

    func onAdFailedToReceive(_ ad: AdropSplashAd, _ errorCode: AdropErrorCode) {
        #if DEBUG
        print("Splash ad failed: \(errorCode)")
        print("  - Check network status")
        print("  - Verify unit ID: \(ad.unitId)")
        #endif
    }

    func onAdImpression(_ ad: AdropSplashAd) {
        #if DEBUG
        print("Splash ad impression")
        #endif
    }

    func onAdClose(impressed: Bool) {
        #if DEBUG
        print("Splash ad closed")
        print("  - Impressed: \(impressed)")
        #endif
    }
}

Troubleshooting

  • Verify window.rootViewController is set correctly
  • Check if SceneDelegate is enabled (Info.plist)
  • Ensure SDK initialization is complete
  • Check network connection
  • Verify the unit ID is correct
  • Confirm production: false setting in test environment
  • Check onAdFailedToReceive error code
  • Verify onAdClose(impressed:) delegate is implemented
  • Ensure screen transition code runs on main thread
func onAdClose(impressed: Bool) {
    DispatchQueue.main.async {
        // Screen transition code
    }
}
  • Verify AdropSplashAdViewDelegate is implemented
  • Check splashAdView.delegate = self is set
  • onAdClose(impressed:) method must be implemented

Next Steps