iOS Question How to use iAdMob ADAdSizeMediumRectangle with admob 3

tufanv

Expert
Licensed User
Longtime User
Hello,

Previously I was using:
adviewsohbet.Initialize("adviewsohbet", ", Page1, no.RunMethod("SIZE_MEDIUM_RECTANGLE", Null))

with inline :

B4X:
#if OBJC

- (NSObject*)customSize:(int)width :(int)height {
   GADAdSize size = GADAdSizeFromCGSize(CGSizeMake(width, height));
  return [NSValue valueWithBytes:&size  objCType:@encode(GADAdSize)];
}
#end if

With latest admob it doesn't compile. What must we change here?

Thanks
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
You are referring to a different inline code. This is the correct ones:
B4X:
#if OBJC
- (NSArray *)GetAdaptiveSize:(float)width {
    GADAdSize g = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(width);
    CGSize s = g.size;
    return @[[NSValue valueWithBytes: &g
                objCType:@encode(GADAdSize)], @(s.width), @(s.height)];
}
- (NSObject*)customSize:(int)width :(int)height {
   GADAdSize size = GADAdSizeFromCGSize(CGSizeMake(width, height));
  return [NSValue valueWithBytes:&size  objCType:@encode(GADAdSize)];
}
- (NSObject*)SIZE_MEDIUM_RECTANGLE {
  return [NSValue valueWithBytes:&GADAdSizeMediumRectangle objCType:@encode(GADAdSize)];
}
#End If
 
Upvote 0
Top