为什么 iAd 可以在 iPhone 上展示,但不能在 iPad 上展示?
我的通用应用程序和 iAd 遇到一些问题。 它在 iPhone 上运行良好,我有一些点击和印象等。但是,每次我在 iPad 上查看该应用程序时,我都会发现它根本无法运行。 我在 iPad 上使用的代码与 iPhone 上的代码完全相同,所以我不确定为什么它会在一个上显示,而在另一个上不显示。
iPadViewController.h
#import <iAd/iAd.h>
@interface iPadViewController : UIViewController <ADBannerViewDelegate, UIActionSheetDelegate>{
ADBannerView *adView;
BOOL bannerIsVisible;
}
@property (nonatomic,retain) IBOutlet ADBannerView *adView;
@property BOOL bannerIsVisible;
@end
iPadViewController.m
#import "iPadViewController.h"
@implementation iPadViewController
@synthesize bannerIsVisible;
@synthesize adView;
-(void)bannerViewDidLoadAd:(ADBannerView *)banner{
if (!self.bannerIsVisible) {
[UIView beginAnimations:@"animateOn" context:NULL];
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
if(self.bannerIsVisible){
[UIView beginAnimations:@"animateOff" context:NULL];
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}
我在 xib 中添加了一个 iAd 并将其链接为 adView。
预先感谢您的任何帮助。
I am having some trouble with my universal app and the iAd.
It is working fine on iPhones and I am having some clicks and impressions etc. Every time I look at the app on my iPad, however, I see that it isn't working at all.
The code that I have used for the iPad is exactly the same as the code for the iPhone so I'm not sure why it will show on one and not on the other.
iPadViewController.h
#import <iAd/iAd.h>
@interface iPadViewController : UIViewController <ADBannerViewDelegate, UIActionSheetDelegate>{
ADBannerView *adView;
BOOL bannerIsVisible;
}
@property (nonatomic,retain) IBOutlet ADBannerView *adView;
@property BOOL bannerIsVisible;
@end
iPadViewController.m
#import "iPadViewController.h"
@implementation iPadViewController
@synthesize bannerIsVisible;
@synthesize adView;
-(void)bannerViewDidLoadAd:(ADBannerView *)banner{
if (!self.bannerIsVisible) {
[UIView beginAnimations:@"animateOn" context:NULL];
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
if(self.bannerIsVisible){
[UIView beginAnimations:@"animateOff" context:NULL];
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}
I have added an iAd in the xib and linked it as adView.
Thanks in advance for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原因可能是您拥有的不同设备上的 iOS 版本不同。我了解到 iAds 仅在 iOS 4 中受支持。您的 iPad 可能有 iOS 3。
The reason might be the different iOS versions in different devices you have. I have read that iAds is only supported in iOS 4. Your iPad might have iOS 3.