实施前置video广告

2014年10月,苹果公司宣布推出前video为iAd的新广告格式

https://developer.apple.com/iad/resources/Implementing-iAd-in-Your-iOS-Apps.PDF

但是,没有执行它们的官方文件。 这种格式是否可用,如果可以的话,他们如何实施?

查看我的示例,了解iAd预卷video广告的工作实施情况:

#import "ViewController.h" @import iAd; @import MediaPlayer; @interface ViewController () { MPMoviePlayerController *moviePlayer; } @end @implementation ViewController -(void)viewDidLoad { [super viewDidLoad]; // Preload ad [MPMoviePlayerController preparePrerollAds]; // Create our MPMoviePlayerController moviePlayer =[[MPMoviePlayerController alloc]init]; [moviePlayer.view setFrame: self.view.bounds]; [moviePlayer setFullscreen:YES animated:YES]; } -(IBAction)playButton:(id)sender { // Add MPMoviePlayerController to our view [self.view addSubview:moviePlayer.view]; // Path of movie you want to play NSString *moviePath = [[NSBundle mainBundle] pathForResource:@"someVideo" ofType:@"MOV"]; // Set the contents of our MPMoviePlayerController to our path [moviePlayer setContentURL:[NSURL fileURLWithPath:moviePath]]; // Prepare our movie for playback [moviePlayer prepareToPlay]; // Play our movie with a prerolled ad [moviePlayer playPrerollAdWithCompletionHandler:^(NSError *error) { if (error) { NSLog(@"%@",error); } [moviePlayer play]; }]; }