首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >已加载iAd横幅,但仍会出现错误。

已加载iAd横幅,但仍会出现错误。
EN

Stack Overflow用户
提问于 2014-07-29 19:12:21
回答 2查看 2K关注 0票数 0

我给我的应用程序添加了一个iAd横幅。如果我在我的设备上运行该应用程序,横幅页,但我仍然会收到错误:

代码语言:javascript
运行
复制
2014-07-29 21:00:55.729 Tipps & Tricks[15639:60b] Cannot find executable for    CFBundle 0x10c185010   </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/MusicLibrary.axbundle> (not loaded)
2014-07-29 21:00:55.732 Tipps & Tricks[15639:60b] Cannot find executable for CFBundle 0x10c18e4b0 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/CertUIFramework.axbundle> (not loaded)
2014-07-29 21:00:55.769 Tipps & Tricks[15639:60b] Cannot find executable for  CFBundle 0x10c24da10 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/GeoServices.axbundle> (not loaded)
2014-07-29 21:00:55.779 Tipps & Tricks[15639:60b] Cannot find executable for CFBundle 0x10c2653b0 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/iAdFramework.axbundle> (not loaded)
2014-07-29 21:00:56.393 Tipps & Tricks[15639:60b] [AppDeveloper] ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=7 "The operation couldn’t be completed. Ad was unloaded from this banner" UserInfo=0x10d81ffb0 {ADInternalErrorCode=7, NSLocalizedFailureReason=Ad was unloaded from this banner, ADInternalErrorDomain=ADErrorDomain}
2014-07-29 21:00:58.794 Tipps & Tricks[15639:60b] [AppDeveloper] ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=3 "The operation couldn’t be completed. Ad inventory unavailable" UserInfo=0x112734b30 {ADInternalErrorCode=3, NSLocalizedFailureReason=Ad inventory unavailable, ADInternalErrorDomain=ADErrorDomain}
2014-07-29 21:00:59.794 Tipps & Tricks[15639:60b] [AppDeveloper] ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=5 "The operation couldn’t be completed. Banner view is visible but does not have content" UserInfo=0x112734ae0 {ADInternalErrorCode=5, NSLocalizedFailureReason=Banner view is visible but does not have content, ADInternalErrorDomain=ADErrorDomain}

代码更新:

.h文件(TableViewController):

代码语言:javascript
运行
复制
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>

@interface UITableViewController (UITableViewController) <ADBannerViewDelegate>

@property (strong, nonatomic) ADBannerView *iAD;
@property (nonatomic, assign) BOOL canDisplayBannerAds;

@end

.m文件(TableViewController):

代码语言:javascript
运行
复制
#import "UITableViewController+UITableViewController.h"
#import <MessageUI/MessageUI.h>
#import "AppDelegate.h"
#import <iAd/iAd.h>


@implementation UITableViewController (UITableViewController)
@dynamic iAD;

#pragma mark iAd Delegate Methods

-(void)bannerViewDidLoadAd:(ADBannerView *)banner{

[UIView beginAnimations:nil context:nil];

[UIView setAnimationDuration:1];

[banner setAlpha:1];

[UIView commitAnimations];

NSLog(@"iAd loaded");
}

-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{

[UIView beginAnimations:nil context:nil];

[UIView setAnimationDuration:1];

[banner setAlpha:0];

[UIView commitAnimations];

NSLog(@"iAd donesn't loaded");

self.iAD.hidden = YES;
}

-(void)viewDidLoad{

self.canDisplayBannerAds = YES;
self.iAD.delegate = self;

}

错误:

代码语言:javascript
运行
复制
2014-08-03 11:37:28.740 Tipps & Tricks[40189:1303] WARNING: Slow defaults access for     key ClientState took 0.066971 seconds, tolerance is 0.020000
2014-08-03 11:37:35.068 Tipps & Tricks[40189:60b] [AppDeveloper] ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=7 "The operation couldn’t be completed. Ad was unloaded from this banner" UserInfo=0xba60df0 {ADInternalErrorCode=7, ADInternalErrorDomain=ADErrorDomain, NSLocalizedFailureReason=Ad was unloaded from this banner}
2014-08-03 11:38:51.973 Tipps & Tricks[40189:60b] [AppDeveloper] ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=7 "The operation couldn’t be completed. Ad was unloaded from this banner" UserInfo=0xb89d280 {ADInternalErrorCode=7, ADInternalErrorDomain=ADErrorDomain, NSLocalizedFailureReason=Ad was unloaded from this banner}

有人知道我能做什么吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-07-29 19:46:29

你有没有跟你的同学说用iAD <ADBannerViewDelegate>

然后在ViewDidLoad中写:

代码语言:javascript
运行
复制
self.banner.delegate = self;

如前所述,还可以实现ADBannerView的委托方法:

代码语言:javascript
运行
复制
didFailToReceiveAdWithError
票数 0
EN

Stack Overflow用户

发布于 2014-08-01 17:43:44

确保将方法命名为-(void)bannerView:

代码语言:javascript
运行
复制
//in the storyboard, the delegate is set to ViewController

@interface ViewController : UIViewController<ADBannerViewDelegate>
@end

@interface ViewController() 
@property(nonatomic, strong) IBOutlet ADBannerView *adBanner;
@end

@implementation View Controller
- (void)viewDidLoad {
self.adBanner.delegate = self;
}
//this is the working method; note the method name
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
    NSLog(@"banner failed to receive ad with error:%@", error);
    if (self.bannerIsVisible) {
        [self hidesBanner];
    }
}
//this is the non working method; not the method name
//this will never fire because Apples method name is different
- (void)adBannerView:(ADBannerView *)adBanner didFailToReceiveAdWithError:(NSError *)error {
    NSLog(@"banner failed to receive ad with error:%@", error);
    if (self.bannerIsVisible) {
        [self hidesBanner];
    }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25023197

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档