iphone - 如果 iAd 未加载,如何显示错误消息?

标签 iphone objective-c ios xcode iad

我在我的一个 iPhone 应用程序中使用 iAd,有时当它无法加载时它会离开屏幕,这是我使用的代码:

-(void)bannerView:(ADBannerView *)aBanner didFailToReceiveAdWithError:(NSError *)error {
if (!self.bannerIsVisible) {
    [UIView beginAnimations:@"animatedAdBannerOff" context:NULL];
    banner.frame = CGRectOffset(banner.frame, 0.0, -320.0);
    [UIView commitAnimations];
    self.bannerIsVisible = NO;
}

问题是当它没有加载时只有一个空白,我怎么会写成标签错误广告无法加载,或者类似的东西???谢谢

最佳答案

使用UIAlertView:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Could not display iAd" delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil];

        [alert show];

关于iphone - 如果 iAd 未加载,如何显示错误消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11778903/

相关文章:

iphone - 限制UITextview的行数

ios - 在异步动画 block 或计时器结束后返回函数值并调用另一个方法的最佳方法

ios - 为什么 subview 不会保留在父框架中?

ios - 将 UISearchController 连接到 UISearchBar,而不将搜索栏嵌入到表格 View 或导航栏中

ios - 使用安全框架在 Objective-C 中以编程方式创建 x509 证书

ios - Stackview 安排问题

iphone - 使用距离位置 : on none CLLocation objects?

ios - 'GPUImageOutput<GPUImageInput>' 没有可见的@interface 声明选择器 'imageFromCurrentlyProcessedOutputWithOrientation:'

ios - 在 mkMapView ios 中的单击按钮中发送对象

iphone - AFNetworking:返回 200 且无内容时运行失败 block