我在我的应用中添加了iAd横幅。如果我在我的设备上运行该应用程序横幅广告,但我仍然会收到错误:
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):
#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):
#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;
}
错误:
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}
有人知道我能做什么吗?
答案 0 :(得分:0)
您是否告诉您的班级使用iAD <ADBannerViewDelegate>
?
然后在ViewDidLoad中写道:
self.banner.delegate = self;
如上所述,实现ADBannerView的委托方法:
didFailToReceiveAdWithError
答案 1 :(得分:0)
确保将方法命名为 - (void)bannerView:
//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];
}
}