Admob SmartBannerLandscape not showing on IOS 8

93 views
Skip to first unread message

jc.pi...@hotmail.co.uk

unread,
Oct 6, 2014, 9:47:51 AM10/6/14
to google-adm...@googlegroups.com
Basically i updated the sdks to latest one , 6.12.0 , all went well all frameworks all linked , no warnings  no errors , in Xcode console the ads received successfully , in the simulator tested on iOS 7 the ads showing , but not on iOS 8?????
Message has been deleted

jc.pi...@hotmail.co.uk

unread,
Oct 6, 2014, 6:14:05 PM10/6/14
to google-adm...@googlegroups.com


anybody pls?

Eric Leichtenschlag

unread,
Oct 6, 2014, 8:53:59 PM10/6/14
to google-adm...@googlegroups.com
Are you sure you're actually running 6.12.0? Try logging [GADRequest sdkVersion] to confirm.

We made a fix to stop serving smart banner landscape ads to iOS 8 devices running a version less than 6.12.0 because the full screen width calculations were broken on 6.11.1 and earlier due to this iOS 8 behavior change.

If you see the sdkVersion is 6.12.0 and are still experiencing this error, please provide a sample app that reproduces the issue.

Thanks,
Eric

On Monday, October 6, 2014 3:14:05 PM UTC-7, jc.pi...@hotmail.co.uk wrote:


anybody pls?

jc.pi...@hotmail.co.uk

unread,
Oct 6, 2014, 9:02:16 PM10/6/14
to google-adm...@googlegroups.com
Thanks for reply , running on iOS 8 , tested on device and simulator , iOS 7x working fine 

console log :

2014-10-06 23:42:18.066 myapp[10324:300607] <Google> To get test ads on this device, call: request.testDevices = @[ GAD_SIMULATOR_ID ];

2014-10-06 23:42:18.197 my app[10324:300607] we

2014-10-06 23:42:21.368 my app[10324:300607] Received ad successfully

2014-10-06 23:42:21.370 my app[10324:300607] SDK version: afma-sdk-i-v6.12.0



-----------------------------------------------------------------------------------

Sample app

----------------------------------------------


(void) adMobSetup

{

    

    

    

    CGPoint origin = CGPointMake(0.0,

                                 self.view.frame.size.width -

                                 CGSizeFromGADAdSize(kGADAdSizeSmartBannerLandscape).height);

                                 

    

    // Use predefined GADAdSize constants to define the GADBannerView.

    self.adBanner = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerLandscape origin:origin];

    

    self.adBanner.adUnitID = k_adMob_ID;

    self.adBanner.delegate = self;

    self.adBanner.rootViewController = self;

    [self.view addSubview:self.adBanner];

    [self.adBanner loadRequest:[self request]];

    

    

}

- (GADRequest *)request {

    GADRequest *request = [GADRequest request];

    

    // Make the request for a test ad. Put in an identifier for the simulator as well as any devices

    // you want to receive test ads.

    

    // comment this line when you add your sign and want to upload on the appstore

    request.testDevices = @[ GAD_SIMULATOR_ID ];

    return request;

}

- (void)adViewDidReceiveAd:(GADBannerView *)adView {

    NSLog(@"Received ad successfully");

    

    NSLog(@"SDK version: %@", [GADRequest sdkVersion]);}


- (void)adView:(GADBannerView *)view didFailToReceiveAdWithError:(GADRequestError *)error {

    NSLog(@"Failed to receive ad with error: %@", [error localizedFailureReason]);

}

------------------------------------





Eric Leichtenschlag

unread,
Oct 6, 2014, 9:16:52 PM10/6/14
to google-adm...@googlegroups.com
So you received the ad! Why isn't it showing up?

jc.pi...@hotmail.co.uk

unread,
Oct 6, 2014, 9:24:06 PM10/6/14
to google-adm...@googlegroups.com
showing well on iOS 7.1 , all frameworks are linked correctly i got no warnings or error ..

i really don't know whats wrong , tested on device with iOS 8 and its not working , 

jc.pi...@hotmail.co.uk

unread,
Oct 7, 2014, 9:56:21 AM10/7/14
to google-adm...@googlegroups.com
Eric , any solution possible ? is it a bug ? i'am using Gamekit farmework  for my development 

Eric Leichtenschlag

unread,
Oct 7, 2014, 12:33:27 PM10/7/14
to google-adm...@googlegroups.com
Can you provide a sample project showing the error?

It must be that the view isn't in the expected spot in the view hierarchy. Maybe it's sitting behind the game or something.

jc.pi...@hotmail.co.uk

unread,
Oct 7, 2014, 2:49:28 PM10/7/14
to google-adm...@googlegroups.com
exactly this what i thought its hidden behind , what excatly i need to provide you which part of the app? 
Message has been deleted

jc.pi...@hotmail.co.uk

unread,
Oct 7, 2014, 4:03:13 PM10/7/14
to google-adm...@googlegroups.com
there is no error at all in my code not even warnnings ! 


On Tuesday, October 7, 2014 5:33:27 PM UTC+1, Eric Leichtenschlag wrote:

jc.pi...@hotmail.co.uk

unread,
Oct 7, 2014, 4:06:32 PM10/7/14
to google-adm...@googlegroups.com
Sample code , gameviewcontroller.m

#import "GameViewController.h"


#import <QuartzCore/CADisplayLink.h>


#import "defined.h"




SystemSoundID soundID;


@interface GameViewController ()










@property ( nonatomic , assign) float rot;


@property ( nonatomic , assign) float speeder;


@property ( nonatomic , assign) int gameScore;




@property ( nonatomic , assign) float speed;


@property ( nonatomic , assign) float vx;


@property ( nonatomic , assign) float vy;


@property ( nonatomic , assign) float friction;


@property ( nonatomic , assign) int maxspeed;


@property ( nonatomic , assign) bool leftNow;


@property ( nonatomic , assign) bool rightNow;




@property ( nonatomic , assign) int whatIsNowLevel;


@property ( nonatomic , assign) int rotationTime;


@property ( nonatomic , assign) int harderNow;




@property ( nonatomic , strong ) AVAudioPlayer * gameOverSound;


@property ( nonatomic , strong ) AVAudioPlayer * smallLaugh;


@property ( nonatomic , strong ) AVAudioPlayer * longLaugh;


@property ( nonatomic , strong ) AVAudioPlayer * pop;






@property ( nonatomic , assign) float flipFlopValue;


@property ( nonatomic , assign) float flipFlopRotation;


@property ( nonatomic , assign) float flipFlopTemp;


@property ( nonatomic , assign) float viewRot;


@property ( nonatomic , strong ) NSTimer *timer;


@property ( nonatomic , assign ) int tempTime;


@property ( nonatomic , assign ) int protectedTimer;


@property ( nonatomic , assign ) int protectedTimerTemp;


@property ( nonatomic , assign ) bool protectedTimerCheck;


@property ( nonatomic , assign ) bool Thunder;


@property ( nonatomic , assign ) int lowSpeedTimer;


@property ( nonatomic , assign ) int QueckTime;


@property ( nonatomic , assign ) int QuackeCounter;


@property ( nonatomic , assign ) int protectedActice;


@property ( nonatomic , assign ) int angleTimer;


@property ( nonatomic , assign ) float limitedScreen;




@property ( nonatomic , assign ) float angleMulti;




@property ( nonatomic , assign ) int LightNoLight;


@property ( nonatomic , assign ) bool isGameCenterAvailable;


@property ( nonatomic , strong )  id displayLink;








@end




@implementation GameViewController


@synthesize Bg;


@synthesize raspberry;


@synthesize bird;


@synthesize backDay;


@synthesize scoreLbl;


@synthesize pineapple;


@synthesize timercounter;


@synthesize gameObject;


@synthesize protecteed;


@synthesize apple;


@synthesize watermelon;


@synthesize pauseView;


@synthesize specialF1;


@synthesize sf;


@synthesize sf2;




@synthesize rot;


@synthesize speeder;


@synthesize gameScore;


@synthesize speed;


@synthesize vx;


@synthesize vy;


@synthesize friction;


@synthesize maxspeed;


@synthesize leftNow , rightNow;


@synthesize whatIsNowLevel;


@synthesize rotationTime;


@synthesize harderNow;


@synthesize flipFlopRotation;


@synthesize flipFlopTemp;


@synthesize flipFlopValue;


@synthesize viewRot;


@synthesize timer;


@synthesize tempTime;


@synthesize protectedTimer;


@synthesize lowSpeedTimer;


@synthesize QueckTime;


@synthesize QuackeCounter;


@synthesize protectedActice;


@synthesize protectedTimerCheck;


@synthesize protectedTimerTemp;


@synthesize Thunder;


@synthesize limitedScreen;




@synthesize LightNoLight;


@synthesize theaudio;


@synthesize angleTimer;


@synthesize angleMulti;


@synthesize isGameCenterAvailable;


@synthesize displayLink;


@synthesize smallLaugh,longLaugh,pop,gameOverSound;




bool soundForOver;


bool soundForFruit;










- (void)viewDidLoad


{


    [super viewDidLoad];


   


    [[NSNotificationCenter defaultCenter] addObserver:self


                                             selector:@selector(appHasGoneInBackground)


                                                 name:UIApplicationDidEnterBackgroundNotification


                                               object:nil];


   


    [[NSNotificationCenter defaultCenter] addObserver:self


                                             selector:@selector(appHasGoneInBackground)


                                                 name:UIApplicationWillResignActiveNotification


                                               object:nil];




       


   


    [self initals];


    [self SoundsSystems];


    [self adMobSetup];




   


   


   


    displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(loop)];


    [displayLink setFrameInterval:1];


   


    [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];




   


        // Do any additional setup after loading the view.


}




- (void) adMobSetup


{


   


   


    CGPoint origin = CGPointMake(0.0,


                                 self.view.frame.size.width -


                                 CGSizeFromGADAdSize(kGADAdSizeSmartBannerLandscape).height);


   


   


    // Use predefined GADAdSize constants to define the GADBannerView.


    self.adBanner = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerLandscape origin:origin];


   


    self.adBanner.adUnitID = k_adMob_ID;


    self.adBanner.delegate = self;


    self.adBanner.rootViewController = self;


    [self.view addSubview:self.adBanner];


    [self.adBanner loadRequest:[self request]];


   


   


}


- (GADRequest *)request {


    GADRequest *request = [GADRequest request];


   


    // Make the request for a test ad. Put in an identifier for the simulator as well as any devices


    // you want to receive test ads.


   


    // comment this line when you add your sign and want to upload on the appstore


   request.testDevices = @[ GAD_SIMULATOR_ID ];


   


    return request;


}


- (void)adViewDidReceiveAd:(GADBannerView *)adView {


    NSLog(@"Received ad successfully");


   


    NSLog(@"SDK version: %@", [GADRequest sdkVersion]);}




- (void)adView:(GADBannerView *)view didFailToReceiveAdWithError:(GADRequestError *)error {


    NSLog(@"Failed to receive ad with error: %@", [error localizedFailureReason]);


}




- (void ) appHasGoneInBackground


{


    [self pauseAction:nil];


}









On Tuesday, October 7, 2014 5:33:27 PM UTC+1, Eric Leichtenschlag wrote:

Eric Leichtenschlag

unread,
Oct 7, 2014, 8:21:14 PM10/7/14
to google-adm...@googlegroups.com
It's still hard to tell just by looking at the code. The first thing I'd try is removing the origin to see if the ad shows when the origin is (0,0).

The next thing I'd try is debugging the view to see exactly where it's being placed. Maybe it's being placed behind another view.
Sample code , gameviewcontroller.m

@property ( nonatomic <spa

...

jc.pi...@hotmail.co.uk

unread,
Oct 7, 2014, 8:27:20 PM10/7/14
to google-adm...@googlegroups.com
here is my UIView+Hierarchy.m , how to remove the origin in code? how the iOS 8 affecting the view ?

#import "UIView+Hierarchy.h"




@implementation UIView(Hierarchy)




-(int)getSubviewIndex


{




        return [self.superview.subviews indexOfObject:self];}




-(void)bringToFront


{


        [self.superview bringSubviewToFront:self];


}




-(void)sendToBack


{


        [self.superview sendSubviewToBack:self];


}




-(void)bringOneLevelUp


{


        int currentIndex = [self getSubviewIndex];


        [self.superview exchangeSubviewAtIndex:currentIndex withSubviewAtIndex:currentIndex+1];


}




-(void)sendOneLevelDown


{


        int currentIndex = [self getSubviewIndex];


        [self.superview exchangeSubviewAtIndex:currentIndex withSubviewAtIndex:currentIndex-1];


}




-(BOOL)isInFront


{


        return ([self.superview.subviews lastObject]==self);


}




-(BOOL)isAtBack


{


        return ([self.superview.subviews objectAtIndex:0]==self);


}




-(void)swapDepthsWithView:(UIView*)swapView


{


        [self.superview exchangeSubviewAtIndex:[self getSubviewIndex] withSubviewAtIndex:[swapView getSubviewIndex]];


}


-(NSUInteger)supportedInterfaceOrientations {


    return UIInterfaceOrientationMaskLandscape;


}


@end




jc.pi...@hotmail.co.uk

unread,
Oct 7, 2014, 8:31:49 PM10/7/14
to google-adm...@googlegroups.com

when i remove the origin the ads showing well on top in iOS 8 ,Good guess !  how now i ll bring it in bottom ?

jc.pi...@hotmail.co.uk

unread,
Oct 7, 2014, 8:58:09 PM10/7/14
to google-adm...@googlegroups.com
I added this code replacing the old one now its working well with ads in bottom of the screen , could you let me know if it can be simplified ?

CGPoint origin;
       
if( self.view.frame.size.height < self.view.frame.size.width){
            origin
= CGPointMake(0.0,
                                 
self.view.frame.size.height -
                                 
CGSizeFromGADAdSize(
                                                 kGADAdSizeSmartBannerLandscape
).height);
       
}else{

            origin
= CGPointMake(0.0,
                                 
self.view.frame.size.width -
                                 
CGSizeFromGADAdSize(

                                                     kGADAdSizeSmartBannerLandscape
).height - self.navigationController.navigationBar.frame.size.height);
       
}
       
self.gAdBannerView = [[GADBannerView alloc]
                              initWithAdSize
:kGADAdSizeSmartBannerLandscape
                              origin
:origin];


Eric Leichtenschlag

unread,
Oct 8, 2014, 12:24:28 PM10/8/14
to google-adm...@googlegroups.com
Ah, so what this boils down to is essentially this: http://stackoverflow.com/questions/24150359/is-uiscreen-mainscreen-bounds-size-becoming-orientation-dependent-in-ios8

iPhone 5 in landscape, iOS 8: self.view.frame = 568x320
iPhone 5 in landscape, iOS 7 and below: self.view.frame = 320x568

So previously, your banner was being shown off screen.

So while your latest statement works, I think your if logic should be "if iOS 7 or below", not "if height < width".

Another way to solve this would be to use Autolayout to lay out your views. Autolayout can have a steep learning curve, so if you try this you'll want to spend a couple hours playing around with it in a sample app. But here is an example of how you could add constraints to the banner to pin it to the bottom center.

Thanks,
Eric



...

jc.pi...@hotmail.co.uk

unread,
Oct 9, 2014, 8:39:52 AM10/9/14
to google-adm...@googlegroups.com
Thanks for your help  Eric , i'll try that :)
Reply all
Reply to author
Forward
0 new messages