6

my code is

    -(void)viewDidLoad
{
    adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
    adView.frame = CGRectOffset(adView.frame, 0, -50);
    adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
    adView.currentContentSizeIdentifier =ADBannerContentSizeIdentifierPortrait;
    [self.view addSubview:adView];
    adView.delegate=self;
    self.bannerIsVisible=NO;

    [super viewDidLoad];

}

//when banner is loaded successfully
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
    if (!self.bannerIsVisible)
    {
        [UIView beginAnimations:@"animateAdBannerOn" context:NULL];
        // banner is invisible now and moved out of the screen on 50 px
        banner.frame = CGRectOffset(banner.frame, 0, 50);
        [UIView commitAnimations];
        self.bannerIsVisible = YES;
    }
}

//when any problems occured
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    if (self.bannerIsVisible)
    {
        [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
        // banner is visible and we move it out of the screen, due to connection issue
        banner.frame = CGRectOffset(banner.frame, 0, -50);
        [UIView commitAnimations];
        self.bannerIsVisible = NO;
    }
}

The code

currentContentSizeIdentifier

requiredContentSizeIdentifiers

ADBannerContentSizeIdentifierPortrait

is deprecated, so what do I replace it with, so it will still work?

I need to do this before I submit it, because if I don't, the app will get rejected.

Please help me

Thanks in Advance

pnuts
  • 58,317
  • 11
  • 87
  • 139
user2167312
  • 129
  • 1
  • 2
  • 6

2 Answers2

12

If you remove the offending lines of code and implement the one below, it will achieve the same result but it is not deprecated.

Remove:

adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier =ADBannerContentSizeIdentifierPortrait;

Add:

[adView setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
JeffN
  • 1,575
  • 15
  • 26
  • This doesn't actually solve the issue. If you removed those lines of code and added NOTHING your code will still work just as well. This is NOT an actual replacement for `requiredContentSizeIdentifiers`, if you had them set to landscape, not portrait, and tried replacing the code with the above code you would see that your app starts breaking. – Albert Renshaw Aug 18 '15 at 07:46
0

iOS 6 comes with many new updates. There are so many autoresize controls are deprecated. ADBannerContentSizeIdentifierPortrait is also deprecated.

Here is link which will help you to solve this issue.

autolayout example

Baby Groot
  • 4,637
  • 39
  • 52
  • 71
Vandana Rao
  • 133
  • 3
  • 13