Git Product home page Git Product logo

larsadcontroller's People

Contributors

aaronwardle avatar apptekstudios avatar bitdeli-chef avatar frugghi avatar larsacus avatar readmecritic avatar yjukaku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

larsadcontroller's Issues

No support for multiple orientations

There is currently only support for portrait orientation since Droid Light is portrait-only. In the future, add support for all orientations.

Need a public interface to the class of the adapter

I need a way to distinguish what class of ad is being displayed. That info doesn't seem to be exposed.

(As for why... My app shrinks the UI when an ad is displayed. AdMob ads have a shadow on top of them, so a 50 pixel add really only needs 30 pixels of display space. Yes, gross, I'm going to modify my apps view by that 20 pixels, but right now I can't think of anything else to do. And I'm getting the 20 from a file I'm hosting so I can change the behavior in the future, still gross, blech!)

Crash iOS6 adMob 6.2.1

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GADObjectPrivate changeState:]: unrecognized selector sent to instance 0xb93cc60'

There are no registered ad network adapter classes.

I get this warning a lot of times:

LARSAdController WARNING [line 521]: There are no registered ad network adapter classes. Please register an ad network class using registerAdClass: before attempting to add ad container view into your view heirarchy.

I do register the adds in My App delegate:

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

I do:
[[LARSAdController sharedManager] registerAdClass:[TOLAdAdapteriAds class]];
[[LARSAdController sharedManager] registerAdClass:[TOLAdAdapterGoogleAds class] withPublisherId:@"xxxxxxxxxxx"];

Any idea what might be causing this? Cause I'm probably losing a lot of ad requests.
Best Regards

RevMob adapter - full width landscape

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");
}

Registering the same adapter with multiple publisher IDs

I got this on my Xcode (4.6) Output.

LARSAdController WARNING [line 282]: Registered adapter classes already contains "TOLAdAdapterGoogleAds" class. Registering the same adapter with multiple publisher IDs is currently unsupported.

To get test ads on this device, call: request.testDevices

I just integrated this new version of lafrsadcontroller and getting below error

xcode 4.6
iOS 6

errors

To get test ads on this device, call: request.testDevices = [NSArray arrayWithObjects:GAD_SIMULATOR_ID, nil];
2013-03-26 21:02:30.402 projectname [41183:1d603] -[GADObjectPrivate changeState:]: unrecognized selector sent to instance 0xac49e60
2013-03-26 21:02:30.402 projectname [41183:1d603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GADObjectPrivate changeState:]: unrecognized selector sent to instance

ads appear behind iOS 7 tab bar

This may be a simulator issue but it's driving me nuts. I converted my project to Xcode 5 and testing on the simulator, the ads are behind my tab bar. Running on an iPhone 5 device they appear as they did in iOS 6, above the tab bar. I noticed that the containerView of the ad has the full height of the display with no allowance for the tab bar. What can I look at to fix this?

Use admob 6.4.2

I have used the cocoapod install and it install admob 6.4.1
AFAIK, 6.4.1 causes apple rejections
can you update it to install admob 6.4.2?

Ads in UITabBarController

Hi,

I found that the AdContainerView frame is not getting set properly when added to a UIViewController that is within a UITabBarController. The ads display in portrait mode, but not landscape.

To fix this problem, I made a simple change to containerFrameForInterfaceOrientation:withPinningLocation: in LARSAdController.m: (I flipped the yOrigin and width assignments)

if (UIInterfaceOrientationIsLandscape(orientation)) {
        TOLLog(@"View is landscape");

        if (pinningLocation == LARSAdControllerPinLocationBottom) {
            yOrigin = CGRectGetHeight(self.parentView.frame);
        }
        width = CGRectGetWidth(self.parentView.frame);
        self.lastOrientationWasPortrait = NO;
    }

MoPub Adapter

MoPub (and other networks through mediation) was very easy to implement.
Here's the code if anyone's interested:

TOLAdAdapterMoPubAds.h


#import  <Foundation/Foundation.h>

#import "LARSAdController.h"
#import "TOLAdAdapter.h"
#import "MPAdView.h"

@interface TOLAdAdapterMoPubAds : NSObject  <TOLAdAdapter, MPAdViewDelegate>

@property (weak, nonatomic) id <LARSAdControllerDelegate> adManager;
@property (nonatomic) BOOL adVisible;
@property (strong, nonatomic) MPAdView *bannerView;
@property (weak, nonatomic) UIViewController *parentViewController;

@end

TOLAdAdapterMoPubAds.m


@implementation TOLAdAdapterMoPubAds

#pragma mark - Required Adapted Implementation

- (UIView *)bannerView{
        if (_bannerView == nil) {
                                   
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
            self.bannerView = [[MPAdView alloc] initWithAdUnitId:@"1234567890"
                                                         size:MOPUB_BANNER_SIZE];
            //Use AdUnitID for banner set up with size 728x90
        
        } else {
            self.bannerView = [[MPAdView alloc] initWithAdUnitId:@"1234567890"
                                                        size:MOPUB_BANNER_SIZE];
            //Use AdUnitID for banner setup with size 320x50
        }
        
            self.bannerView.delegate = self;
            self.bannerView.frame = CGRectMake(0, self.bannerView.superview.bounds.size.height - MOPUB_BANNER_SIZE.height,
                                               MOPUB_BANNER_SIZE.width, MOPUB_BANNER_SIZE.height);
           
            [self.bannerView loadAd];
           


    }
        
    return _bannerView;
    


}

- (void)layoutBannerForInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
    //Simply sets the banner view to inherit the same bounds as the container

    [self.bannerView rotateToOrientation:interfaceOrientation];
     
}


#pragma mark -  required implementation

- (UIViewController *)viewControllerForPresentingModalView {
    return _parentViewController;
}

#pragma mark - Optional MoPub methods

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    CGSize size = [self.bannerView adContentViewSize];
    CGFloat centeredX = (self.bannerView.superview.bounds.size.width - size.width) / 2;
    CGFloat bottomAlignedY = self.bannerView.superview.bounds.size.height - size.height;
    self.bannerView.frame = CGRectMake(centeredX, bottomAlignedY, size.width, size.height);
}

- (void)adViewDidLoadAd:(MPAdView *)view
{
    CGSize size = [view adContentViewSize];
    CGFloat centeredX = (self.bannerView.superview.bounds.size.width - size.width) / 2;
    CGFloat bottomAlignedY = self.bannerView.superview.bounds.size.height - size.height;
    view.frame = CGRectMake(centeredX, bottomAlignedY, size.width, size.height);
    
        TOLLog(@"Ad loaded successfullly");
        NSLog(@"Ad loaded successfullly");
        if ([self.adManager respondsToSelector:@selector(adSucceededForNetworkAdapterClass:)]) {
            [self.adManager adSucceededForNetworkAdapterClass:[self class]];
            
            NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
            CGFloat moPubBannerCount = [defaults floatForKey:[NSStringFromClass(self.class) stringByAppendingString:@"Count"]];
            moPubBannerCount++;
            [defaults setInteger:moPubBannerCount forKey:[NSStringFromClass(self.class) stringByAppendingString:@"Count"]];
            [defaults synchronize];
        }
}

- (void)adViewDidFailToLoadAd:(MPAdView *)view {
    
    [self.adManager adFailedForNetworkAdapterClass:[self class]];
    NSLog(@"Ad load fail");
    
}


- (void)dealloc{

    _bannerView = nil;
    self.adManager = nil;
    
    TOLLog(@"Dealloc");
}

#pragma mark - Optional Adapter Implementation

- (void)setParentViewController:(UIViewController *)viewController{
    _parentViewController = viewController;
    
    [self layoutBannerForInterfaceOrientation:viewController.interfaceOrientation];
}


+ (BOOL)requiresPublisherId{
    return NO;
}

+ (BOOL)requiresParentViewController{
    return YES;
}

- (NSString *)friendlyNetworkDescription{
    return @"MoPub Ads";
}

@end

Crash on iPhone 5 iOS 6.0.2 ADBannerView was deallocated

Crash on iPhone 5 iOS 6.0.2

An instance 0x229033a0 of class ADBannerView was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
<NSKeyValueObservationInfo 0x229020b0> (
<NSKeyValueObservance 0x22902070: Observer: 0x229041c0, Key path: bannerLoaded, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x22902030>

Logs:

2013-01-18 09:43:00.895 MyApp[6169:907] LARSAdController [line 182]: View is portrait
2013-01-18 09:43:00.896 MyApp[6169:907] LARSAdController [line 205]: Container frame: {{0, 454}, {320, 50}}
2013-01-18 09:43:00.897 MyApp[6169:907] LARSAdController [line 494]: Creating new instance of adapter class "TOLAdAdapterGoogleAds"
2013-01-18 09:43:01.046 MyApp[6169:907] LARSAdController [line 534]: Successfully created instance of "TOLAdAdapterGoogleAds"
2013-01-18 09:43:01.047 MyApp[6169:907] LARSAdController [line 445]: Initial banner frame : {{0, 50}, {320, 50}}
2013-01-18 09:43:01.048 MyApp[6169:907] LARSAdController [line 470]: Final banner frame : {{0, 0}, {320, 50}}
2013-01-18 09:43:01.049 MyApp[6169:907] LARSAdController [line 667]: Registering for orientation notifications
2013-01-18 09:43:01.050 MyApp[6169:907] LARSAdController [line 182]: View is portrait
2013-01-18 09:43:01.051 MyApp[6169:907] LARSAdController [line 205]: Container frame: {{0, 454}, {320, 50}}
2013-01-18 09:43:01.052 MyApp[6169:907] LARSAdController [line 470]: Final banner frame : {{0, 0}, {320, 50}}
2013-01-18 09:43:01.082 MyApp[6169:907] LARSAdController [line 688]: Handling orientation change
2013-01-18 09:43:01.883 MyApp[6169:907] LARSAdController [line 182]: View is portrait
2013-01-18 09:43:01.884 MyApp[6169:907] LARSAdController [line 205]: Container frame: {{0, 454}, {320, 50}}
2013-01-18 09:43:01.885 MyApp[6169:907] LARSAdController [line 470]: Final banner frame : {{0, 0}, {320, 50}}
2013-01-18 09:43:01.888 MyApp[6169:907] LARSAdController [line 688]: Handling orientation change
2013-01-18 09:43:01.901 MyApp[6169:907] LARSAdController [line 182]: View is portrait
2013-01-18 09:43:01.902 MyApp[6169:907] LARSAdController [line 205]: Container frame: {{0, 454}, {320, 50}}
2013-01-18 09:43:01.903 MyApp[6169:907] LARSAdController [line 470]: Final banner frame : {{0, 0}, {320, 50}}
2013-01-18 09:43:02.944 MyApp[6169:907] TOLAdAdapterGoogleAds [line 110]: Google ad did receive ad
2013-01-18 09:43:05.972 MyApp[6169:907] LARSAdController [line 182]: View is portrait
2013-01-18 09:43:05.973 MyApp[6169:907] LARSAdController [line 205]: Container frame: {{0, 454}, {320, 50}}
2013-01-18 09:43:05.974 MyApp[6169:907] LARSAdController [line 470]: Final banner frame : {{0, 0}, {320, 50}}
2013-01-18 09:43:19.326 MyApp[6169:907] LARSAdController [line 445]: Initial banner frame : {{0, 50}, {320, 50}}
2013-01-18 09:43:19.327 MyApp[6169:907] LARSAdController [line 494]: Creating new instance of adapter class "TOLAdAdapteriAds"
2013-01-18 09:43:19.328 MyApp[6169:907] LARSAdController [line 534]: Successfully created instance of "TOLAdAdapteriAds"
2013-01-18 09:43:19.331 MyApp[6169:907] LARSAdController [line 445]: Initial banner frame : {{0, 50}, {320, 50}}
2013-01-18 09:43:19.332 MyApp[6169:907] TOLAdAdapterGoogleAds [line 119]: Google ad did fail to receive ad
2013-01-18 09:43:27.711 MyApp[6169:907] LARSAdController [line 620]: Attempting to halt iAds ad network
2013-01-18 09:43:27.711 MyApp[6169:907] LARSAdController [line 657]: iAds ad network allocated, but not visible (no ad loaded)
2013-01-18 09:43:27.712 MyApp[6169:907] LARSAdController [line 470]: Final banner frame : {{0, 0}, {320, 50}}
2013-01-18 09:43:27.713 MyApp[6169:907] TOLAdAdapterGoogleAds [line 110]: Google ad did receive ad
2013-01-18 09:43:29.199 MyApp[6169:907] LARSAdController [line 593]: Ad loaded for iAds!
2013-01-18 09:43:29.200 MyApp[6169:907] LARSAdController [line 470]: Final banner frame : {{0, 0}, {320, 50}}
2013-01-18 09:43:29.202 MyApp[6169:907] TOLAdAdapteriAds [line 108]: iAd did load ad
2013-01-18 09:43:39.055 MyApp[6169:907] LARSAdController [line 620]: Attempting to halt iAds ad network
2013-01-18 09:43:39.056 MyApp[6169:907] LARSAdController [line 623]: Hiding iAds ad network
2013-01-18 09:43:39.057 MyApp[6169:907] LARSAdController [line 445]: Initial banner frame : {{0, 50}, {320, 50}}
2013-01-18 09:43:39.058 MyApp[6169:907] TOLAdAdapterGoogleAds [line 110]: Google ad did receive ad
2013-01-18 09:43:39.320 MyApp[6169:907] LARSAdController [line 634]: Destroying iAds ad network instance
2013-01-18 09:43:39.324 MyApp[6169:907] An instance 0x229033a0 of class ADBannerView was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
<NSKeyValueObservationInfo 0x229020b0> (
<NSKeyValueObservance 0x22902070: Observer: 0x229041c0, Key path: bannerLoaded, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x22902030>
)
(lldb)

Google ad click through issue in modal view

Clickthrough on google ads works in root view, but not in modal views behind the root controller, instead I get a warning:

Warning: Attempt to present GADBrowserController: 0x1751e950> on MainViewController: 0x95a6ae0> whose view is not in the window hierarchy!

However, if I click though an iAd first in a modal view, close the browser window, and subsequently a google ad appears, clicking through the Google ad suddenly works.

code hangs

I created a new project for your code. Its working fine on simulator.

As soon as i test on IPhone4S .... Program hangs during execution of below code

static LARSAdController *_sharedManager;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedManager = [[super allocWithZone:NULL] init];
});

So somehow when its creating the manger in the block..... its delayed or kind of stuck ..... Any idea what is missing ???

Landscape Ads Don't Appear with a Tab Bar Controller

Easy issue to reproduce:

  1. Create a new Tabbed Application in XCode

  2. Add LARSAdController and the necessary additional files (AdMob, frameworks, etc)

  3. Add LAC code to your view controller:

[[LARSAdController sharedManager] addAdContainerToView:self.view withParentViewController:self];
[[LARSAdController sharedManager] setShouldHandleOrientationChanges:YES];
[[LARSAdController sharedManager] setGoogleAdPublisherId:@"pubID"];
  1. Ads will display fine in Portrait Mode, but when you rotate to Landscape they fail to appear.

Ads pinned to bottom don't layout correctly in landscape mode

landscapemode

I have an ipad app that uses a UISplitViewController and I'm trying to display ads in the right hand view (the details viewcontroller). In portrait mode everything looks correct, but in landscape mode the ads hover a little ways off the bottom of the view, and they extend off the view on the left and right sides.

A possible Bug

Hi Lars:

After call
[[LARSAdController sharedManager] addAdContainerToViewInViewController:self]
, containerView with clearColor with be top of the view hierarchy.
Therefore, before Ad is available (or visible), that will prohibit touch events for the UIControls
under that containerView.

Mixing LARSAdController with ARC

Hi Larsacus!

First of all, thanks for this great job!!

I would like to ask you about the behavior when the app is going to the background, because when the app is in background release all the views, and when you put again to the app, the app crash, because some banner is waiting a view who is released by the system.
I tried to put a nil the delegates whe you are going to background in the app delegate, but this is not a good solution, because the banner is blank for some moments.

Thanks in advance!!

TOLAdAdapteriAds was deallocated while key value observers were still registered with it

I'm a neophyte iPhone developer so if I don't understand this please correct me.

I was running into this error when making the call:

[[LARSAdController sharedManager]destroyAllAdBanners];

It appears the offending line in destoryAllAdBanners is:

[self.adapterInstances removeAllObjects];

This was getting executed before the animateBannerForAdapterHidden completion handler finished.

I modified the method to remove each adapter when it was safe to do so:

- (void)destroyAllAdBanners{
    NSArray *instances = [self.adapterInstances allValues];

    for (id <TOLAdAdapter> adapterInstance in instances) {
        if (adapterInstance.adVisible) {
            [self animateBannerForAdapterHidden:adapterInstance withCompletion:^{
                [self cleanUpAdAdapter:adapterInstance];
                [self.adapterInstances removeObjectForKey:adapterInstance];
            }];
        } else {
            [self.adapterInstances removeObjectForKey:adapterInstance];
        }
    }
}

Is this sound?

Possible code changes

Hi Larsacus:

Thanks for your sharing. I have possible code changes.

  • (void)destroyAllAdBanners{
    NSArray *instances = [self.adapterInstances allValues];

    for (id adapterInstance in instances) {
    if (adapterInstance.adVisible) {
    [self animateBannerForAdapterHidden:adapterInstance withCompletion:^{
    //[self cleanUpAdAdapter:adapterInstance]; /* should cleanUP no matter it's visible or not*/
    }];
    }

     [self cleanUpAdAdapter:adapterInstance];
    

    }

    [self.adapterInstances removeAllObjects];
    /*
    to remove it from superview, so later you'r ad will pop up if
    you call [[LARSAdController sharedManager] addAdContainerToViewInViewController:self];
    */
    [_containerView removeFromSuperview];

}

How to hide Ads...no Destroy them?

Hello,
I'm trying to implement your code in Baker Framework. It work great and symplify a lot my tasks since I'm not a programmer .
What I'm wondering, since BAKER is a magazine ebook framework, is just to tell LARSAd to "hide" the Ads in some pages. I have correctly dysplayed Ads in all pages,and in a range of pages, BUT, since the only way to hide them is to use the DestroyAllBanners method, when I do so, later when returning ie: page 3 and telling to addAdContainetoViewInViewController doesnt seem to recover the ads....
¿Is there a way of just hiding the ads temporarily?
Thank you very much

Ad conceals subview

I have an app which displays several screens with tableviews and one with a map. I've implemented the tableviews as a subview of the viewcontroller which inherits from TOLAdViewController. This displays the ad on the bottom. Unfortunately this doesn't resize the other subview in the parent view so that it makes room for it. It just sits on top of it.

I would like to have it resize the other subview so that it doesn't conceal the information shown in that subview. I've tried setting the following things in my viewcontroller's viewDidLoad method:

self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view setAutoresizesSubviews:YES];

Adapter ratio management

Most people who integrate the LARSAdController likely do so in order to use 2 or more adapters with it. I think it would be interesting to offer not only a primary/backup adapter model but also an adapter ratio based model.
A very basic way to do this would be to increase e.g. an NSUserDefaults stored integer in the adapter's successful load delegate methods (e.g. adViewDidReceiveAd for AdMob or revmobAdDisplayed for RevMob). In the App delegate a simple check of the actual ratios versus desired ratios could then decide on which adapter is prioritized (e.g. something like if((adMobCount/(adMobCount + revMobCount + 1) <= 0.6) { register AdMob adapter first }else{ register RevMob adapter first}.

The idea would be of course to come to a cleaner way of doing this. e.g. by integrating it into an optional LarsAdController registerAdClass method e.g. something like:

  • (void)registerAdClass:(Class)class withPublisherId:(NSString *)publisherId withRatio:(float)adRatio;

What could make it even more interesting is to start off with an even ratio between multiple adapters and after a minimum amount of clicks has been reached, prioritize the adapter that produces most clicks by the user. iAd has a delegate method called bannerViewActionShouldBegin and RevMob has one called revmobUserClickedInTheAd that could be used to track this, not sure about AdMob.
Something like if((iAdClicks + revMobClicks) > 10 && iAdClicks/(iAdClicks + revMobClicks) >= 0.5) { register iAd adapter first }else{ register RevMob adapter first}.

Thoughts?

PS I personally intend to control the ad network ratios remotely via GroundControl based on highest eCPM.

Master/detail view on iOS7

Hi,

I'm implementing an app that uses the master/detail views. On iOS7 the ad container never appears on the master view where the tableView is. There is no problem showing the container when I enter the detail view which is just a regular uiview.

Running the same app on iOS6 there are no problems and the ad container is presented just fine in both master and detail view.

I've only tried this on the simulator thus far, but I don't see why that should make a difference ... (famous last words ;-) )

I'll get back to you if I find out how to solve it before you do.

Cheers,
-Kristian Stobbe

adBanner out of screen when coming back from another viewController in landscape

Hi,

Thanks for all the good work.
I had the following bug with iPad and landscape orientation.

My app consist of a main viewController with an adBanner and a settings viewController with no ad banner.
iPad is in landscape orientation.
I put addAdContainerToView in main viewController's viewWillAppear as you said.
On first launched, the adbanner is loaded and everything is ok.

Then when the settings viewController is launched, I hide the adBanner.
When the settings viewController is dismissed, I unhide the adBanner. My main viewController viewWillAppear is fired and the bug starts there.
In LARSADController, the pb is in containerFrameForInterfaceOrientation: orientation is UIDeviceOrientationLandscape but the size returned by self.parentView.frame is portrait, and so the adBanner goes off screen.

If I shake a little the iPad, layoutBannerViewsForCurrentOrientation is fired again and the ad banner comes back.

So I added the following quick fix in containerFrameForInterfaceOrientation to switch the values if necessary:
if (yOrigin > width) {
CGFloat newWidth = yOrigin;
yOrigin = width;
width = newWidth;
}

and now, everythings works fine :)

Container frame is incorrect when returning from clicked ad

When a user returns from clicking on an ad (both iAd and Google ads), the adContainer positioning is incorrect and the banner is shown offscreen. This is easily corrected by rotating to a new interface orientation, but annoying nonetheless.

How to unregister AdClass?

Hi Lars,

Now I am using
[[LARSAdController sharedManager] registerAdClass:[TOLAdAdapteriAds class]];
to register a adapter, is it possible to unregister it and clear all related resources?

BTW, I found GADRequest will conflict with HTML5 audio process, that's also why I wanna release related resource manually to see if I can solve this problem.

thanks.

destroyIAds + destroyGoogleAdsAnimated have been removed, can't turn off ads at runtime

- (void)destroyIAds;
- (void)destroyGoogleAdsAnimated:(BOOL)animated;

The above methods have been made private.

In my app, I use IAP to allow purchase of my app, after purchase, I turn off the ads.
I use the following code...

[[LARSAdController sharedManager] destroyIAds];
[[LARSAdController sharedManager] destroyGoogleAdsAnimated:YES];

But this no longer works.

Please advise !!

How to use this with a UISplitViewController?

Hi,

I current have a split view controller project and would like to add this to serve up my adverts, however when I try to load the banner it only appears in the detail view window and not across the entire window in my split view controller?

Thanks Aaron

iAds shows half ad in iOS6

Yes, I was testing my app, and after update to iOS6, iads only show half ad (maybe is because the new sceen dimensions of iphone) :S

Thanks!!!

No network access => placeholder / text, something?

While I've been testing in the simulator, I often forget to switch from the home network location on my mbp. So with the simulator also having no net access, I noticed that no ad is served.

As you'd expect.

From the point of view, encouraging users to buy my app, from annoyance of ads, having nothing looks odd.

I know this isn't a common issue and obviously saving an ad is pointless as can't redirect.

But a placeholder of some kind maybe with some default text, would be a great feature.

Google adapter complaining about not setting root view controller

Google adapter complaining about not setting root view controller. So, I added this line in
TOLAdAdapterGoogleAds: - (GADBannerView *)bannerView{

    [_bannerView setRootViewController:[self parentViewController]];

Not showing issue all the time and not sure if it would work for all uses, but works for me.

Issue with orientation changes with navigationbar and toolbar

Hi,

here on iOS6/iPhone (4 and 5) I am getting adds misplaced when the orientation goes from landscape to portrait. What happens is that the banner is positioned under the toolbar and, on every rotation, it keeps going down toward the bottom until is out of bounds.

Anybody reproduced this error?

Thanks

iPhone Admob rotation from Portrait to Landscape

I am testing out your sample example on the iOS 6 iPhone simulator and on launch it brings up a Admob ad in Portrait. Once I rotate to Landscape the add goes away.

Notes:

  • Works fine on iAD ads.
  • Works on iPad

Here are the logs if it helps:
2013-01-18 08:29:16.553 adcontrollerdemo[31920:c07] LARSAdController [line 182]: View is portrait
2013-01-18 08:29:16.554 adcontrollerdemo[31920:c07] LARSAdController [line 205]: Container frame: {{0, 410}, {320, 50}}
2013-01-18 08:29:16.554 adcontrollerdemo[31920:c07] LARSAdController [line 494]: Creating new instance of adapter class "TOLAdAdapterGoogleAds"
2013-01-18 08:29:16.579 adcontrollerdemo[31920:c07] LARSAdController [line 534]: Successfully created instance of "TOLAdAdapterGoogleAds"
2013-01-18 08:29:16.579 adcontrollerdemo[31920:c07] LARSAdController [line 445]: Initial banner frame : {{0, 50}, {320, 50}}
2013-01-18 08:29:16.579 adcontrollerdemo[31920:c07] LARSAdController [line 470]: Final banner frame : {{0, 0}, {320, 50}}
2013-01-18 08:29:16.580 adcontrollerdemo[31920:c07] LARSAdController [line 667]: Registering for orientation notifications
2013-01-18 08:29:16.581 adcontrollerdemo[31920:c07] LARSAdController [line 182]: View is portrait
2013-01-18 08:29:16.581 adcontrollerdemo[31920:c07] LARSAdController [line 205]: Container frame: {{0, 410}, {320, 50}}
2013-01-18 08:29:16.581 adcontrollerdemo[31920:c07] LARSAdController [line 470]: Final banner frame : {{0, 0}, {320, 50}}
2013-01-18 08:29:16.583 adcontrollerdemo[31920:c07] LARSAdController [line 688]: Handling orientation change
2013-01-18 08:29:16.585 adcontrollerdemo[31920:c07] LARSAdController [line 688]: Handling orientation change
2013-01-18 08:29:16.585 adcontrollerdemo[31920:c07] LARSAdController [line 182]: View is portrait
2013-01-18 08:29:16.585 adcontrollerdemo[31920:c07] LARSAdController [line 205]: Container frame: {{0, 410}, {320, 50}}
2013-01-18 08:29:16.586 adcontrollerdemo[31920:c07] LARSAdController [line 470]: Final banner frame : {{0, 0}, {320, 50}}
2013-01-18 08:29:16.586 adcontrollerdemo[31920:c07] LARSAdController [line 182]: View is portrait
2013-01-18 08:29:16.587 adcontrollerdemo[31920:c07] LARSAdController [line 205]: Container frame: {{0, 410}, {320, 50}}
2013-01-18 08:29:16.587 adcontrollerdemo[31920:c07] LARSAdController [line 470]: Final banner frame : {{0, 0}, {320, 50}}
2013-01-18 08:29:17.098 adcontrollerdemo[31920:c07] TOLAdAdapterGoogleAds [line 106]: Google ad did receive ad
2013-01-18 08:29:17.902 adcontrollerdemo[31920:c07] LARSAdController [line 688]: Handling orientation change
2013-01-18 08:29:17.904 adcontrollerdemo[31920:c07] LARSAdController [line 173]: View is landscape
2013-01-18 08:29:17.904 adcontrollerdemo[31920:c07] LARSAdController [line 205]: Container frame: {{0, 250}, {480, 50}}
2013-01-18 08:29:17.908 adcontrollerdemo[31920:c07] LARSAdController [line 470]: Final banner frame : {{0, 18}, {480, 32}}

Obscured banner view

Hello,

Thanks for making the LARS Adcontroller. It grew to my heart as well as the LARS prefix, I am not so convenient with TOL :)

Anyway, banners work great, only when an iAd is visible, and the device is rotated, I'll get this warning:

"ADBannerView: WARNING A banner view has an ad but may be obscured. This message is only printed once per banner view"

In theory, in this situation banners are not refreshed until the banner gets un-obscured.

Is this warning important? Does it affect anything badly or is it safe to ignore it?

Best,
Kara

Admob ads moving horizontally off the screen for iPad

Hi,

I updated my app to the latest LARSAdController and the latest Admob SDK. iPhone and iPod Touch are working fine, but the iPad version is not.

On iPad the ads are appearing and moving immediately to the left end of the screen with a couple of centimeters (= an inch) showing (i think not from the actual ad as it is click-able but only text, no color). It seems that they are moving further away with each refresh.

Any advice how to fix it? I have been trying for a few hours without success ...

Thanks.

(I have used the singleton without any customization ... just adding it and adding the lines of code in my VC.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.