Skip to content

Aniview/ad-player-sdk-ios-pods

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 

Repository files navigation

AdPlayerSDK iOS

Requirements

Installation

AdPlayerSDK is available through CocoaPods. To install it, add the following line to your Podfile:

target 'YourApp' do
  pod 'AdPlayerSDK'
  
  # uncomment the following to use RxSwift based config (iOS < 13)
  # pod 'RxSwift'
end


# uncomment the following to use RxSwift based config (iOS < 13)
#post_install do |installer|
#  installer.pods_project.targets.each do |target|
#    target.build_configurations.each do |config|
#      if target.name == 'RxSwift'
#           config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
#      end
#    end
#  end
#end

Usage example

AppDelegate.swift

import AdPlayerSDK
import AppTrackingTransparency

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

        createLandingScreen()

        AdPlayer.initSdk()

        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