AdWhirl代表没有收到消息

时间:2013-07-15 00:23:52

标签: ios objective-c delegates adwhirl

我是Adwhirl的新手并且遇到了一些问题。我将我的mainScreen控制器设置为AdView的委托。虽然我在这个视图中,广告刷新就好了。当我切换到另一个视图时,代理不再收到任何新广告(代理选择器不会被触发)。是否有一个原因?我想为我的整个应用程序添加一个adView,所以我将指针传递到任何地方并将其作为子视图添加到正确的视图中。

以下是一些代码:

#pragma mark AdWhirl required delegate methods
- (NSString *)adWhirlApplicationKey {
    return MY_AD_WHIRL_APPLICATION_KEY;
}

- (UIViewController *)viewControllerForPresentingModalView {
    return self;
}

- (void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView {
    adView.hidden = NO;
    if (self.view.window) {
    [UIView beginAnimations:@"AdWhirlDelegate.adWhirlDidReceiveAd:"
                    context:nil];
    [UIView setAnimationDuration:0.7];
    CGSize adSize = [adView actualAdSize];
    CGRect newFrame = adView.frame;
    newFrame.size = adSize;
    newFrame.origin.x = (self.view.bounds.size.width - adSize.width)/ 2;
    newFrame.origin.y = self.view.bounds.size.height - 50;
    adView.frame = newFrame;
    [UIView commitAnimations];
    }else {
        [UIView beginAnimations:@"AdWhirlDelegate.adWhirlDidReceiveAd:"
                        context:nil];
        [UIView setAnimationDuration:0.7];
        CGSize adSize = [adView actualAdSize];
        CGRect newFrame = adView.frame;
        newFrame.size = adSize;
        newFrame.origin.x = (self.view.bounds.size.width - adSize.width)/ 2;
        //newFrame.origin.y = self.view.bounds.size.height - 50;
        adView.frame = newFrame;
        [UIView commitAnimations];
    }
}
-(void)adWhirlDidFailToReceiveAd:(AdWhirlView *)adWhirlView usingBackup:(BOOL)yesOrNo
{
    adView.hidden = YES;
}

注意:主屏幕控制器是我的应用程序启动的..所以它始终驻留在内存中。这有责任在屏幕上推送其他视图。我错过了一些让这个工作的东西吗?

0 个答案:

没有答案