我正在创建一个主要使用 iAd 的 iOS 应用程序,但由于它们的填充率如此之低,我想添加另一个收入来源以在 iAd 不加载时使用。我决定使用 RevMob,因为我已经将它们用于我的另一个应用程序并且它们非常好。
当我运行该应用程序时,这是我得到的:
2014-02-11 18:53:50.364 Colors[5629:60b] [RevMob] Starting RevMobAds
2014-02-11 18:53:50.694 Colors[5629:60b] [RevMob] Initializating Banner.
2014-02-11 18:53:50.695 Colors[5629:60b] [RevMob] Requesting banner data.
2014-02-11 18:53:51.176 Colors[5629:60b] [RevMob] Device requirements not met (422).
2014-02-11 18:53:51.177 Colors[5629:60b] [RevMob] Error on banner: The operation couldn’t be completed. (Device requirements not met (422). error -1.)
2014-02-11 18:53:51.179 Colors[5629:60b] Ad error: Error Domain=Device requirements not met (422). Code=-1 "The operation couldn’t be completed. (Device requirements not met (422). error -1.)"
2014-02-11 18:53:51.209 Colors[5629:60b] [RevMob] App can't be registered in RevMob servers
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[RevMobAds startSessionWithAppID:@"*(I've tried deleting and re-adding the app in RevMob and getting a new id to no avail)"];
// [RevMobAds session].parallaxMode = RevMobParallaxModeOff;
return YES;
}
视图控制器.m:
-(void)bannerViewDidLoadAd:(ADBannerView *)banner {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[banner setAlpha:1];
[UIView commitAnimations];
[[RevMobAds session] hideBanner];
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[banner setAlpha:0];
[UIView commitAnimations];
[self loadRevMobAd];
}
-(void)loadRevMobAd {
RevMobBannerView *banner = [[RevMobAds session] bannerView];
banner.delegate = self;
[banner loadWithSuccessHandler:^(RevMobBannerView *banner) {
if (adBanner) {
[banner setFrame:adBanner.frame];
NSLog(@"Loaded adBanner");
} else {
[banner setFrame:iPadAdBanner.frame];
NSLog(@"Loaded iPadAdBanner");
}
[self.view addSubview:banner];
NSLog(@"Ad loaded");
} andLoadFailHandler:^(RevMobBannerView *banner, NSError *error) {
NSLog(@"Ad error: %@",error);
} onClickHandler:^(RevMobBannerView *banner) {
NSLog(@"Ad clicked");
}];
}
我以前用过 RevMob,不记得遇到过这么多麻烦。当我在 Xcode 上运行这个应用程序时,我正在我的 iPhone 5s (7.0.4) 上构建它