【问题标题】:iAd banner is loaded but still get an erroriAd 横幅已加载,但仍出现错误
【发布时间】:2014-07-29 19:12:21
【问题描述】:

我在我的应用中添加了 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}

有人知道我能做什么吗?

【问题讨论】:

  • 你实现了委托方法并设置了横幅视图的委托吗?

标签: objective-c iad


【解决方案1】:

你有没有告诉你的班级使用 iAD &lt;ADBannerViewDelegate&gt;

然后在 ViewDidLoad 中写入:

self.banner.delegate = self;

如上所述,实现ADBannerView的委托方法:

didFailToReceiveAdWithError

【讨论】:

  • 我在 viewDidLoad 方法中添加了self.banner.delegate = self; 行。现在我没有收到第一个错误,但出现了另一个错误,我不知道为什么,因为我的 tableviewcontroller 中没有横幅。 2014-08-01 22:34:55.991 Tipps &amp; Tricks[32930:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewController iAD]: unrecognized selector sent to instance 0x10c04a230'我刚刚在tableView类的.h文件中添加了这个方法:@property (strong, nonatomic) ADBannerView *iAD;
  • 请在此处显示您在问题中的代码(只需使用代码更新您的问题)。
  • 您是否在界面生成器中链接了您的 iAD 对象?
  • 你应该创建 IBOutlet
  • 我无法创建 IBOutlet,因为我在情节提要中没有实际添加的 iAd 横幅。
【解决方案2】:

确保您将方法命名为 -(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];
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多