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 }
// production 배포 시, 'true'를 사용하세요.
// 특정 국가에서 이 SDK를 사용하고 있다면,
// ISO 3166 alpha-2 국가 코드 array를 전달하세요.
// 타겟 링크가 열리는 브라우저 설정이 필요하다면, useInAppBrowser 값을 바꿔주세요.
Adrop.initialize(production: false, targetCountries: [], useInAppBrowser: false);
self.window = UIWindow(windowScene: windowScene)
let splashViewController = AdropSplashAdViewController(unitId: "PUBLIC_TEST_UNIT_ID_SPLASH")
splashViewController.backgroundColor = .systemBackground
splashViewController.logoImage = UIImage(named: "your_logo_name")
splashViewController.mainViewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()
splashViewController.displayDuration = 1
splashViewController.delegate = self
self.window?.rootViewController = splashViewController
self.window?.makeKeyAndVisible()
}
}
extension SceneDelegate: AdropSplashAdDelegate {
func onAdReceived(_ ad: AdropAds.AdropSplashAd) {
print("onAdReceived \(ad.unitId) \(ad.creativeId)")
}
func onAdFailedToReceive(_ ad: AdropAds.AdropSplashAd, _ errorCode: AdropAds.AdropErrorCode) {
print("onAdFailedToReceive: \(ad.unitId) error: \(AdropErrorCodeToString(code: errorCode))")
}
func onAdImpression(_ ad: AdropSplashAd) {
print("onAdImpression: \(ad.unitId)")
}
}