larsacus / LARSAdController

Lightweight ad mediation for iOS to properly manage multiple ad networks dynamically including iAd and Google ads.
http://theonlylars.com/blog/2013/01/10/stupid-easy-ads-with-larsadcontroller-3-dot-0/
MIT License
269 stars 60 forks source link

RevMob adapter - full width landscape #36

Closed Fred10932 closed 11 years ago

Fred10932 commented 11 years ago

I have Revmob working (with AdMob as backup) using below methods, but using the same width for landscape as portrait. If anyone knows a solution, that would be great.

- (RevMobBannerView *)bannerView{
if (_bannerView == nil && _publisherId) {
    [RevMobAds startSessionWithAppID:_publisherId];

    //[RevMobAds session].testingMode = RevMobAdsTestingModeWithoutAds;

    _bannerView = [[RevMobAds session] bannerView];
    _bannerView.delegate = self;
    [_bannerView loadAd];

    // Couldn't get layoutBannerForInterfaceOrientation method working, used this solution for now:

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        _bannerView.frame = CGRectMake(0, 0, 768, 90);
      } else {
        _bannerView.frame = CGRectMake(0, 0, 320, 40);
    }
    [self.bannerView setNeedsLayout];
}
else if(!_publisherId){
    NSLog(@"RevMob Publisher ID not set. No ads will be served until you set one using %@ on %@!", NSStringFromSelector(@selector(registerAdClass:withPublisherId:)),NSStringFromClass([LARSAdController class]));
}
return _bannerView;
}

#pragma mark - Required RevMob methods

-(void)revmobAdDidFailWithError:(NSError *)error {
NSLog(@"Ad failed with error: %@", error);
if ([self.adManager respondsToSelector:@selector(adFailedForNetworkAdapterClass:)]) {
    [self.adManager adFailedForNetworkAdapterClass:[self class]];
}
}

-(void)revmobAdDidReceive {
NSLog(@"Ad loaded successfullly");
if ([self.adManager     respondsToSelector:@selector(adSucceededForNetworkAdapterClass:)]) {
    [self.adManager adSucceededForNetworkAdapterClass:[self class]];
}
}

-(void)revmobAdDisplayed {
NSLog(@"Ad displayed");

}

-(void)revmobUserClickedInTheAd {
NSLog(@"User clicked in the ad");
}

-(void)revmobUserClosedTheAd {
NSLog(@"User closed the ad");
}
larsacus commented 11 years ago

Do you have this in a branch I can clone and try out?

larsacus commented 11 years ago

Is this the full implementation of the adapter? Or is there a branch I can try out?

Fred10932 commented 11 years ago

Hi Lars Sorry was out for the weekend. I have a branch ready but need collaborator status to upload.

larsacus commented 11 years ago

If you have a fork of the project, you can push the branch up to your own fork.

Fred10932 commented 11 years ago

OK -- see RevMob branch @ https://github.com/Fred10932/LARSAdController.git

larsacus commented 11 years ago

I guess I'm really not sure what the specific issue is, but I did clean it up a bit. Check out my RevMob branch.

I'm not sure what it's supposed to look like in landscape as right now all it does is stretch the test ad.

Fred10932 commented 11 years ago

Thanks. I also tested some live banners with your solution and indeed RevMob (there are only a few varieties) doesn't adapt its banners to more screen real estate, they just stretch out. I think constraining the banner to a 320 (iPhone) or 768 (iPad) width may be the way to go for this adapter after all.