我需要在页面底部显示FlurryAdBanner横幅。这是我的代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
FlurrySessionBuilder* builder = [[[[[FlurrySessionBuilder new]
withLogLevel:FlurryLogLevelAll]
withCrashReporting:YES]
withSessionContinueSeconds:10]
withAppVersion:@"0.1.2"];
[Flurry startSession:@"PGQ4YPRDNXWR7MRK745M" withSessionBuilder:builder];
// Override point for customization after application launch.
return YES;
}
ViewController。代码
@interface ViewController ()<FlurryAdBannerDelegate>
{
FlurryAdBanner* adBanner;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
adBanner = [[FlurryAdBanner alloc] initWithSpace:@"bottomAdd"];
adBanner.adDelegate = self;
[adBanner fetchAndDisplayAdInView:self.view viewControllerForPresentation:self];
}
- (void) adBannerDidFetchAd:(FlurryAdBanner*)bannerAd{
NSLog(@" Ad Space [%@] Did Receive Ad ===== ", bannerAd );
[bannerAd displayAdInView:self.view viewControllerForPresentation:self];
}
- (void) adBannerDidRender:(FlurryAdBanner*)bannerAd {
NSLog(@" Ad Space [%@] Did Display Ad ===== ", [bannerAd space]);
}
- (void) adBannerWillPresentFullscreen:(FlurryAdBanner*)bannerAd{
NSLog(@" Ad Space [%@] Will Present Fullscreen Ad ===== ", [bannerAd space]);
}
- (void) adBanner:(FlurryAdBanner*) bannerAd adError:(FlurryAdError) adError errorDescription:(NSError*) errorDescription{
NSLog(@" Ad Space [%@] Did Fail to Receive Ad with error [%@] ===== ", [bannerAd space], errorDescription);
}
- (void) adBannerDidReceiveClick:(FlurryAdBanner*)bannerAd{
NSLog(@" Ad Space [%@] Did Receive Click ===== ", [bannerAd space]);
}
- (void) adBannerDidDismissFullscreen:(FlurryAdBanner*)bannerAd {
NSLog(@" Ad Space [%@] Will Dismiss for ===== ", [bannerAd space]);
}
- (void) adBannerWillLeaveApplication:(FlurryAdBanner*)bannerAd {
NSLog(@" Ad Space [%@] Will Leave Application ===== ", [bannerAd space]);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
在yahoo开发人员中,我创建了应用程序unitID。不知道出了什么问题。没有叫任何委托。请帮助我。
答案 0 :(得分:0)
将您的viewDidAppear和adBannerDidFetchAd切换到以下代码。您已经在视图中进行了获取和显示,但在adBannerDidFetchAd中也获得了第二显示
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
adBanner = [[FlurryAdBanner alloc] initWithSpace:@"bottomAdd"];
adBanner.adDelegate = self;
viewControllerForPresentation:self];
[adBanner fetchAdForFrame:self.view.frame];
}
- (void) adBannerDidFetchAd:(FlurryAdBanner*)bannerAd{
NSLog(@" Ad Space [%@] Did Receive Ad ===== ", bannerAd );
[bannerAd displayAdInView:self.view viewControllerForPresentation:self];
}