Skip to content

Aniview/ad-player-sdk-ios-spm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AdPlayerSDK iOS

Requirements

Installation

In XCode:

Usage example

AppDelegate.swift

import AdPlayerSDK
import AppTrackingTransparency

class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        let yourAppStoreUrl = URL(string: ...)!
        AdPlayer.initSdk(storeURL: yourAppStoreUrl)

        return true
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        DispatchQueue.main.async { // ensure the app view is ready
            ATTrackingManager.requestTrackingAuthorization { status in
                print("Tracking: authorized:", status == .authorized)
            }
        }
    }
}

YourViewController.swift

import AdPlayerSDK

class YourViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        let placement = AdPlayerPlacementView(tagId: tagId)
        placement.translatesAutoresizingMaskIntoConstraints = false
        view.addSubview(placement)
        NSLayoutConstraint.activate([
            placement.leadingAnchor.constraint(equalTo: view.leadingAnchor),
            placement.trailingAnchor.constraint(equalTo: view.trailingAnchor),
            placement.topAnchor.constraint(equalTo: view.layoutMarginsGuide.topAnchor)
        ])
    }
}

Sample project

ADPlayerBasicSample

Author

https://aniview.com/

License

All rights reserved to ANIVIEW LTD 2024

About

AdPlayerSDK iOS - Swift Package Manager

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages