IMA SDK ช่วยให้คุณผสานรวมโฆษณามัลติมีเดียเข้ากับเว็บไซต์และแอปได้อย่างง่ายดาย IMA SDK สามารถ ขอโฆษณาจาก เซิร์ฟเวอร์โฆษณาที่สอดคล้องกับ VAST และจัดการการเล่นโฆษณาในแอปได้ SDK ฝั่งไคลเอ็นต์ IMA ช่วยให้คุณควบคุมการเล่นวิดีโอเนื้อหาได้ ขณะที่ SDK จะจัดการการเล่นโฆษณา โฆษณาจะเล่นในวิดีโอเพลเยอร์แยกต่างหาก ซึ่งวางอยู่ด้านบนของวิดีโอเพลเยอร์เนื้อหาของแอป
คู่มือนี้แสดงวิธีผสานรวม IMA SDK เข้ากับแอปวิดีโอเพลเยอร์ หากต้องการดูหรือทำตามการผสานรวมตัวอย่างที่เสร็จสมบูรณ์แล้ว ให้ดาวน์โหลด BasicExample จาก GitHub
ภาพรวมฝั่งไคลเอ็นต์ IMA
การติดตั้งใช้งานฝั่งไคลเอ็นต์ IMA เกี่ยวข้องกับคอมโพเนนต์ SDK หลัก 4 รายการ ซึ่งคู่มือนี้จะแสดงให้เห็น
IMAAdDisplayContainer: ออบเจ็กต์คอนเทนเนอร์ที่ระบุตำแหน่งที่ IMA แสดงผลองค์ประกอบ UI ของโฆษณาและวัดการมองเห็นโฆษณา ซึ่งรวมถึงมุมมองแอ็กทีฟและ การวัดแบบเปิดIMAAdsLoader: ออบเจ็กต์ที่ขอโฆษณาและจัดการเหตุการณ์จากการตอบสนองต่อคำขอโฆษณา คุณควรสร้างอินสแตนซ์ของตัวโหลดโฆษณาเพียงรายการเดียว ซึ่งสามารถนำกลับมาใช้ใหม่ได้ตลอดอายุการใช้งานของแอปพลิเคชันIMAAdsRequest: ออบเจ็กต์ที่กำหนดคำขอโฆษณา คำขอโฆษณาระบุ URL สำหรับแท็กโฆษณา VAST รวมถึงพารามิเตอร์เพิ่มเติม เช่น ขนาดโฆษณาIMAAdsManager: ออบเจ็กต์ที่มีการตอบสนองต่อคำขอโฆษณา ควบคุมการเล่นโฆษณา และรอเหตุการณ์โฆษณาที่ SDK เรียกใช้
ข้อกำหนดเบื้องต้น
ก่อนเริ่มต้น คุณต้องมีสิ่งต่อไปนี้
- Xcode 13 ขึ้นไป
- วิธีติดตั้ง IMA SDK มีดังนี้
- Swift Package Manager (แนะนำ)
- CocoaPods
- สำเนา IMA SDK สำหรับ iOS ที่ดาวน์โหลด
1. สร้างโปรเจ็กต์ Xcode ใหม่
สร้างโปรเจ็กต์ iOS ใหม่ใน Xcode โดยใช้ Objective-C หรือ Swift ใช้ BasicExample เป็นชื่อโปรเจ็กต์
2. เพิ่ม IMA SDK ลงในโปรเจ็กต์ Xcode
หากต้องการติดตั้ง IMA SDK ให้เลือกวิธีที่ต้องการ
แนะนำ: ติดตั้ง SDK โดยใช้ Swift Package Manager
SDK โฆษณาสื่ออินเทอร์แอกทีฟรองรับ Swift Package Manager ตั้งแต่เวอร์ชัน 3.18.4 เป็นต้นไป หากต้องการนำเข้าแพ็กเกจ Swift ให้ทำตามขั้นตอนต่อไปนี้
ใน Xcode ให้ติดตั้งแพ็กเกจ IMA SDK Swift โดยไปที่File > Add Package Dependencies...
ในข้อความแจ้ง ให้ค้นหาที่เก็บ GitHub ของแพ็กเกจ IMA iOS SDK Swift:
swift-package-manager-google-interactive-media-ads-iosเลือกเวอร์ชันของแพ็กเกจ IMA SDK Swift ที่ต้องการใช้ สำหรับโปรเจ็กต์ใหม่ เราขอแนะนำให้ใช้Up to Next Major Version
เมื่อดำเนินการเสร็จแล้ว Xcode จะแก้ไขการขึ้นต่อกันของแพ็กเกจและดาวน์โหลดไว้ในเบื้องหลัง ดูรายละเอียดเพิ่มเติมเกี่ยวกับวิธีเพิ่มการขึ้นต่อกันของแพ็กเกจได้ในบทความของ Apple
ติดตั้ง SDK โดยใช้ CocoaPods
CocoaPods เป็นตัวจัดการทรัพยากร Dependency สำหรับโปรเจ็กต์ Xcode และเป็นวิธีที่แนะนำในการติดตั้ง IMA SDK ดูข้อมูลเพิ่มเติมเกี่ยวกับการติดตั้งหรือการใช้ CocoaPods ได้ในเอกสารประกอบของ CocoaPods เมื่อติดตั้ง CocoaPods แล้ว ให้ใช้คำแนะนำต่อไปนี้เพื่อติดตั้ง IMA SDK
สร้างไฟล์ข้อความชื่อ Podfile ในไดเรกทอรีเดียวกับไฟล์ BasicExample.xcodeproj แล้วเพิ่มการกำหนดค่าต่อไปนี้
platform :ios, '15' target "BasicExample" do pod 'GoogleAds-IMA-iOS-SDK', '~> 3.32.0' endเรียกใช้
pod install --repo-updateจากไดเรกทอรีที่มี Podfileตรวจสอบว่าการติดตั้งสำเร็จโดยเปิดไฟล์ BasicExample.xcworkspace และยืนยันว่ามี 2 โปรเจ็กต์ ได้แก่ BasicExample และ Pods (การขึ้นต่อกันที่ CocoaPods ติดตั้ง)
ดาวน์โหลดและติดตั้ง SDK ด้วยตนเอง
หากไม่ต้องการใช้ Swift Package Manager ให้ดาวน์โหลดและเพิ่ม IMA SDK ลงในโปรเจ็กต์ด้วยตนเอง
3. สร้างวิดีโอเพลเยอร์
ขั้นแรก ให้ติดตั้งใช้งานวิดีโอเพลเยอร์ ในตอนแรก เพลเยอร์นี้จะไม่ได้ใช้ IMA SDK และไม่มีเมธอดที่จะทริกเกอร์การเล่น
Objective-C
นำเข้าการขึ้นต่อกันของเพลเยอร์ด้วยคำสั่งต่อไปนี้
#import "ViewController.h"
@import AVFoundation;
ตั้งค่าตัวแปรของเพลเยอร์ด้วยคำสั่งต่อไปนี้
@interface ViewController () <IMAAdsLoaderDelegate, IMAAdsManagerDelegate>
/// Content video player.
@property(nonatomic, strong) AVPlayer *contentPlayer;
/// Play button.
@property(nonatomic, weak) IBOutlet UIButton *playButton;
/// UIView in which we will render our AVPlayer for content.
@property(nonatomic, weak) IBOutlet UIView *videoView;
เริ่มต้นวิดีโอเพลเยอร์เมื่อโหลดมุมมองด้วยคำสั่งต่อไปนี้
@implementation ViewController
// The content URL to play.
NSString *const kTestAppContentUrl_MP4 =
@"https://storage.googleapis.com/gvabox/media/samples/stock.mp4";
// Ad tag
NSString *const kTestAppAdTagUrl = @"https://pubads.g.doubleclick.net/gampad/ads?"
@"iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&"
@"ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&"
@"correlator=";
- (void)viewDidLoad {
[super viewDidLoad];
self.playButton.layer.zPosition = MAXFLOAT;
[self setupAdsLoader];
[self setUpContentPlayer];
}
#pragma mark Content Player Setup
- (void)setUpContentPlayer {
// Load AVPlayer with path to our content.
NSURL *contentURL = [NSURL URLWithString:kTestAppContentUrl_MP4];
self.contentPlayer = [AVPlayer playerWithURL:contentURL];
// Create a player layer for the player.
AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.contentPlayer];
// Size, position, and display the AVPlayer.
playerLayer.frame = self.videoView.layer.bounds;
[self.videoView.layer addSublayer:playerLayer];
// Set up our content playhead and contentComplete callback.
self.contentPlayhead = [[IMAAVPlayerContentPlayhead alloc] initWithAVPlayer:self.contentPlayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(contentDidFinishPlaying:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:self.contentPlayer.currentItem];
}
- (IBAction)onPlayButtonTouch:(id)sender {
[self requestAds];
self.playButton.hidden = YES;
}
Swift
นำเข้าการขึ้นต่อกันของเพลเยอร์ด้วยคำสั่งต่อไปนี้
import AVFoundation
ตั้งค่าตัวแปรของเพลเยอร์ด้วยคำสั่งต่อไปนี้
class PlayerContainerViewController: UIViewController, IMAAdsLoaderDelegate, IMAAdsManagerDelegate {
static let contentURL = URL(
string: "https://storage.googleapis.com/gvabox/media/samples/stock.mp4")!
private var contentPlayer = AVPlayer(url: PlayerContainerViewController.contentURL)
private lazy var playerLayer: AVPlayerLayer = {
AVPlayerLayer(player: contentPlayer)
}()
เริ่มต้นวิดีโอเพลเยอร์เมื่อโหลดมุมมองด้วยคำสั่งต่อไปนี้
private lazy var videoView: UIView = {
let videoView = UIView()
videoView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(videoView)
NSLayoutConstraint.activate([
videoView.bottomAnchor.constraint(
equalTo: view.safeAreaLayoutGuide.bottomAnchor),
videoView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
videoView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),
videoView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
])
return videoView
}()
// MARK: - View controller lifecycle methods
override func viewDidLoad() {
super.viewDidLoad()
videoView.layer.addSublayer(playerLayer)
adsLoader.delegate = self
NotificationCenter.default.addObserver(
self,
selector: #selector(contentDidFinishPlaying(_:)),
name: .AVPlayerItemDidPlayToEndTime,
object: contentPlayer.currentItem)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
playerLayer.frame = videoView.layer.bounds
}
override func viewWillTransition(
to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator
) {
coordinator.animate { _ in
// do nothing
} completion: { _ in
self.playerLayer.frame = self.videoView.layer.bounds
}
}
// MARK: - Public methods
func playButtonPressed() {
requestAds()
}
4. นำเข้า IMA SDK
หากต้องการนำเข้า IMA SDK ให้ทำดังนี้
Objective-C
นำเข้า IMA SDK ด้วยคำสั่งต่อไปนี้
@import GoogleInteractiveMediaAds;สร้างตัวแปรสำหรับคลาส
IMAAdsLoader,IMAAVPlayerContentPlayheadและIMAAdsManagerที่ใช้ในแอปด้วยคำสั่งต่อไปนี้// SDK /// Entry point for the SDK. Used to make ad requests. @property(nonatomic, strong) IMAAdsLoader *adsLoader; /// Playhead used by the SDK to track content video progress and insert mid-rolls. @property(nonatomic, strong) IMAAVPlayerContentPlayhead *contentPlayhead; /// Main point of interaction with the SDK. Created by the SDK as the result of an ad request. @property(nonatomic, strong) IMAAdsManager *adsManager;
Swift
นำเข้า IMA SDK ด้วยคำสั่งต่อไปนี้
import GoogleInteractiveMediaAdsสร้างตัวแปรสำหรับคลาส
IMAAdsLoader,IMAAVPlayerContentPlayheadและIMAAdsManagerที่ใช้ในแอปด้วยคำสั่งต่อไปนี้static let adTagURLString = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/" + "single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&" + "gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&correlator=" private let adsLoader = IMAAdsLoader() private var adsManager: IMAAdsManager? private lazy var contentPlayhead: IMAAVPlayerContentPlayhead = { IMAAVPlayerContentPlayhead(avPlayer: contentPlayer) }()
5. ติดตั้งใช้งานเครื่องมือติดตามเพลย์เฮดของเนื้อหาและเครื่องมือสังเกตการสิ้นสุดสตรีม
IMA SDK ต้องติดตามตำแหน่งปัจจุบันของเนื้อหาวิดีโอจึงจะเล่นโฆษณาคั่นกลางได้ หากต้องการทำเช่นนี้ ให้สร้างคลาสที่ติดตั้งใช้งาน IMAContentPlayhead หากคุณใช้ AVPlayer ดังที่แสดงในตัวอย่างนี้
SDK จะมีคลาส IMAAVPlayerContentPlayhead ซึ่งจะทำหน้าที่นี้ให้คุณ
หากไม่ได้ใช้ AVPlayer คุณจะต้องติดตั้งใช้งาน IMAContentPlayhead ในคลาสของคุณเอง
นอกจากนี้ คุณยังต้องแจ้งให้ SDK ทราบเมื่อเนื้อหาเล่นจบแล้วเพื่อให้ SDK แสดงโฆษณาตอนท้ายได้ โดยเรียกใช้
contentComplete
เมธอดใน IMAAdsLoader โดยใช้ AVPlayerItemDidPlayToEndTimeNotification
Objective-C
สร้างอินสแตนซ์ IMAAVPlayerContentPlayhead ในการตั้งค่าเพลเยอร์ด้วยคำสั่งต่อไปนี้
// Set up our content playhead and contentComplete callback.
self.contentPlayhead = [[IMAAVPlayerContentPlayhead alloc] initWithAVPlayer:self.contentPlayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(contentDidFinishPlaying:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:self.contentPlayer.currentItem];
สร้างเมธอด contentDidFinishPlaying() เพื่อเรียกใช้ IMAAdsLoader.contentComplete() เมื่อเนื้อหาเล่นจบด้วยคำสั่งต่อไปนี้
- (void)contentDidFinishPlaying:(NSNotification *)notification {
// Make sure we don't call contentComplete as a result of an ad completing.
if (notification.object == self.contentPlayer.currentItem) {
[self.adsLoader contentComplete];
}
}
Swift
สร้างเครื่องมือสังเกตการสิ้นสุดเนื้อหาในการตั้งค่าเพลเยอร์ด้วยคำสั่งต่อไปนี้
NotificationCenter.default.addObserver(
self,
selector: #selector(contentDidFinishPlaying(_:)),
name: .AVPlayerItemDidPlayToEndTime,
object: contentPlayer.currentItem)
สร้างเมธอด contentDidFinishPlaying() เพื่อเรียกใช้ IMAAdsLoader.contentComplete() เมื่อเนื้อหาเล่นจบด้วยคำสั่งต่อไปนี้
@objc func contentDidFinishPlaying(_ notification: Notification) {
// Make sure we don't call contentComplete as a result of an ad completing.
if notification.object as? AVPlayerItem == contentPlayer.currentItem {
adsLoader.contentComplete()
}
}
6. เริ่มต้นตัวโหลดโฆษณาและส่งคำขอโฆษณา
หากต้องการขอโฆษณาชุดหนึ่ง คุณต้องสร้างอินสแตนซ์ IMAAdsLoader
ตัวโหลดนี้จะประมวลผลออบเจ็กต์ IMAAdsRequest ที่เชื่อมโยงกับ URL แท็กโฆษณาที่ระบุ
แนวทางปฏิบัติแนะนำคือให้เก็บอินสแตนซ์ IMAAdsLoader ไว้เพียงรายการเดียวตลอดวงจรชีวิตของแอป หากต้องการส่งคำขอโฆษณาเพิ่มเติม ให้สร้างออบเจ็กต์ IMAAdsRequest ใหม่ แต่ใช้ IMAAdsLoader รายการเดิม ดูข้อมูลเพิ่มเติมได้ที่
คำถามที่พบบ่อยเกี่ยวกับ IMA SDK
Objective-C
- (void)setupAdsLoader {
self.adsLoader = [[IMAAdsLoader alloc] initWithSettings:nil];
self.adsLoader.delegate = self;
}
- (void)requestAds {
// Create an ad display container for ad rendering.
IMAAdDisplayContainer *adDisplayContainer =
[[IMAAdDisplayContainer alloc] initWithAdContainer:self.videoView
viewController:self
companionSlots:nil];
// Create an ad request with our ad tag, display container, and optional user context.
IMAAdsRequest *request = [[IMAAdsRequest alloc] initWithAdTagUrl:kTestAppAdTagUrl
adDisplayContainer:adDisplayContainer
contentPlayhead:self.contentPlayhead
userContext:nil];
[self.adsLoader requestAdsWithRequest:request];
}
Swift
private func requestAds() {
// Create ad display container for ad rendering.
let adDisplayContainer = IMAAdDisplayContainer(
adContainer: videoView, viewController: self, companionSlots: nil)
// Create an ad request with our ad tag, display container, and optional user context.
let request = IMAAdsRequest(
adTagUrl: PlayerContainerViewController.adTagURLString,
adDisplayContainer: adDisplayContainer,
contentPlayhead: contentPlayhead,
userContext: nil)
adsLoader.requestAds(with: request)
}
7. ตั้งค่าผู้รับมอบสิทธิ์ของตัวโหลดโฆษณา
ในเหตุการณ์การโหลดสำเร็จ IMAAdsLoader จะเรียกใช้
adsLoadedWithData
เมธอดของผู้รับมอบสิทธิ์ที่กำหนด โดยส่งอินสแตนซ์ IMAAdsManager ไปให้ จากนั้นคุณสามารถเริ่มต้นตัวจัดการโฆษณา ซึ่งจะโหลดโฆษณาแต่ละรายการตามที่กำหนดโดยการตอบสนองต่อ URL แท็กโฆษณา
นอกจากนี้ อย่าลืมจัดการข้อผิดพลาดที่อาจเกิดขึ้นระหว่างกระบวนการโหลด หากโฆษณาไม่โหลด ให้ตรวจสอบว่าการเล่นสื่อยังคงดำเนินต่อไปโดยไม่มีโฆษณา เพื่อไม่ให้รบกวนประสบการณ์ของผู้ใช้
Objective-C
- (void)adsLoader:(IMAAdsLoader *)loader adsLoadedWithData:(IMAAdsLoadedData *)adsLoadedData {
// Grab the instance of the IMAAdsManager and set ourselves as the delegate.
self.adsManager = adsLoadedData.adsManager;
self.adsManager.delegate = self;
// Create ads rendering settings to tell the SDK to use the in-app browser.
IMAAdsRenderingSettings *adsRenderingSettings = [[IMAAdsRenderingSettings alloc] init];
adsRenderingSettings.linkOpenerPresentingController = self;
// Initialize the ads manager.
[self.adsManager initializeWithAdsRenderingSettings:adsRenderingSettings];
}
- (void)adsLoader:(IMAAdsLoader *)loader failedWithErrorData:(IMAAdLoadingErrorData *)adErrorData {
// Something went wrong loading ads. Log the error and play the content.
NSLog(@"Error loading ads: %@", adErrorData.adError.message);
[self.contentPlayer play];
}
Swift
func adsLoader(_ loader: IMAAdsLoader, adsLoadedWith adsLoadedData: IMAAdsLoadedData) {
// Grab the instance of the IMAAdsManager and set ourselves as the delegate.
adsManager = adsLoadedData.adsManager
adsManager?.delegate = self
// Create ads rendering settings and tell the SDK to use the in-app browser.
let adsRenderingSettings = IMAAdsRenderingSettings()
adsRenderingSettings.linkOpenerPresentingController = self
// Initialize the ads manager.
adsManager?.initialize(with: adsRenderingSettings)
}
func adsLoader(_ loader: IMAAdsLoader, failedWith adErrorData: IMAAdLoadingErrorData) {
if let message = adErrorData.adError.message {
print("Error loading ads: \(message)")
}
contentPlayer.play()
}
8. ตั้งค่าผู้รับมอบสิทธิ์ของตัวจัดการโฆษณา
สุดท้ายนี้ ตัวจัดการโฆษณาต้องมีผู้รับมอบสิทธิ์ของตัวเองเพื่อจัดการเหตุการณ์และการเปลี่ยนแปลงสถานะ IMAAdManagerDelegate มีเมธอดสำหรับจัดการเหตุการณ์และข้อผิดพลาดของโฆษณา รวมถึงเมธอดสำหรับทริกเกอร์การเล่นและการหยุดชั่วคราวในเนื้อหาวิดีโอ
เริ่มเล่น
รอเหตุการณ์ LOADED เพื่อเริ่มเล่นเนื้อหาและโฆษณา ดูรายละเอียดเพิ่มเติมได้ที่
didReceiveAdEvent
Objective-C
- (void)adsManager:(IMAAdsManager *)adsManager didReceiveAdEvent:(IMAAdEvent *)event {
// When the SDK notified us that ads have been loaded, play them.
if (event.type == kIMAAdEvent_LOADED) {
[adsManager start];
}
}
Swift
func adsManager(_ adsManager: IMAAdsManager, didReceive event: IMAAdEvent) {
// When the SDK notifies us the ads have been loaded, play them.
if event.type == IMAAdEventType.LOADED {
adsManager.start()
}
}
จัดการข้อผิดพลาด
เพิ่มตัวแฮนเดิลสำหรับข้อผิดพลาดของโฆษณาด้วย หากเกิดข้อผิดพลาด ให้เล่นเนื้อหาต่อ เช่นเดียวกับในขั้นตอนก่อนหน้า
Objective-C
- (void)adsManager:(IMAAdsManager *)adsManager didReceiveAdError:(IMAAdError *)error {
// Something went wrong with the ads manager after ads were loaded. Log the error and play the
// content.
NSLog(@"AdsManager error: %@", error.message);
[self.contentPlayer play];
}
Swift
func adsManager(_ adsManager: IMAAdsManager, didReceive error: IMAAdError) {
// Something went wrong with the ads manager after ads were loaded.
// Log the error and play the content.
if let message = error.message {
print("AdsManager error: \(message)")
}
contentPlayer.play()
}
รอเหตุการณ์การเล่นและการหยุดชั่วคราว
เมธอดผู้รับมอบสิทธิ์ 2 รายการสุดท้ายที่คุณต้องติดตั้งใช้งานจะทริกเกอร์เหตุการณ์การเล่นและการหยุดชั่วคราวในเนื้อหาวิดีโอพื้นฐานเมื่อ IMA SDK ขอ การทริกเกอร์การหยุดชั่วคราวและการเล่นเมื่อมีการขอจะช่วยไม่ให้ผู้ใช้พลาดส่วนต่างๆ ของเนื้อหาวิดีโอเมื่อโฆษณาแสดง
Objective-C
- (void)adsManagerDidRequestContentPause:(IMAAdsManager *)adsManager {
// The SDK is going to play ads, so pause the content.
[self.contentPlayer pause];
}
- (void)adsManagerDidRequestContentResume:(IMAAdsManager *)adsManager {
// The SDK is done playing ads (at least for now), so resume the content.
[self.contentPlayer play];
}
Swift
func adsManagerDidRequestContentPause(_ adsManager: IMAAdsManager) {
// The SDK is going to play ads, so pause the content.
contentPlayer.pause()
}
func adsManagerDidRequestContentResume(_ adsManager: IMAAdsManager) {
// The SDK is done playing ads (at least for now), so resume the content.
contentPlayer.play()
}
เท่านี้ก็เรียบร้อย ตอนนี้คุณขอและแสดงโฆษณาด้วย IMA SDK ได้แล้ว หากต้องการดูข้อมูล เกี่ยวกับฟีเจอร์เพิ่มเติมของ SDK โปรดดูคู่มืออื่นๆ หรือ ตัวอย่างใน GitHub
ขั้นตอนถัดไป
หากต้องการเพิ่มรายได้จากโฆษณาในแพลตฟอร์ม iOS ให้ ขอสิทธิ์ App Transparency and Tracking เพื่อใช้ IDFA