Teddy13
Teddy13

Reputation: 3854

iAD error when trying to implement

I am following a tutorial on how to incorporate iAds into my app but so far it is a struggle. The tutorial incorporates the fact that users with ios 3.0 may have problems. it can be found here: http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app

These are my build settings for my PROJECT:

Architectures: armv6 armv7 Base SDK: Latest iOS (iOS 5.0) Build active Architecture only: No Valid Architectures: armv6 armv 7

Build Setting for TARGETS:

Architectures: armv6 armv7
Base SDK: Latest iOS (iOS 5.0)
Build active Architecture only: No
Valid Architectures: armv6 armv 7

Thank you in advance, been trying to find an answer for a while!

This is the error I am getting:

Undefined symbols for architecture armv6:
  "_ADBannerContentSizeIdentifier480x32", referenced from:
      -[newPastResultViewController createAdBannerView] in newPastResultViewController.o
      -[newPastResultViewController fixupAdView:] in newPastResultViewController.o
  "_ADBannerContentSizeIdentifier320x50", referenced from:
      -[newPastResultViewController createAdBannerView] in newPastResultViewController.o
      -[newPastResultViewController fixupAdView:] in newPastResultViewController.o
ld: symbol(s) not found for architecture armv6
clang: error: linker command failed with exit code 1 (use -v to see invocation)

// Inside my .m file

      - (int)getBannerHeight:(UIDeviceOrientation)orientation {
  if (UIInterfaceOrientationIsLandscape(orientation)) {
    return 32;
   } else {
    return 50;
}
}




 - (int)getBannerHeight {
return [self getBannerHeight:[UIDevice currentDevice].orientation];
}





- (void)createAdBannerView {
Class classAdBannerView = NSClassFromString(@"ADBannerView");
if (classAdBannerView != nil) {
    self.adBannerView = [[[classAdBannerView alloc] 
                          initWithFrame:CGRectZero] autorelease];
    [_adBannerView setRequiredContentSizeIdentifiers:[NSSet setWithObjects: 
                                                         ADBannerContentSizeIdentifier320x50, 
                                                      ADBannerContentSizeIdentifier480x32, nil]];
    if (UIInterfaceOrientationIsLandscape([UIDevice currentDevice].orientation)) {
        [_adBannerView setCurrentContentSizeIdentifier:
         ADBannerContentSizeIdentifier480x32];
    } else {
        [_adBannerView setCurrentContentSizeIdentifier:
         ADBannerContentSizeIdentifier320x50];            
    }
    [_adBannerView setFrame:CGRectOffset([_adBannerView frame], 0, 
                                         -[self getBannerHeight])];
    [_adBannerView setDelegate:self];

    [self.view addSubview:_adBannerView];        
}
}



 - (void)fixupAdView:(UIInterfaceOrientation)toInterfaceOrientation {
if (_adBannerView != nil) {        
    if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
        [_adBannerView setCurrentContentSizeIdentifier:
         ADBannerContentSizeIdentifier480x32];
    } else {
        [_adBannerView setCurrentContentSizeIdentifier:
         ADBannerContentSizeIdentifier320x50];
    }          
    [UIView beginAnimations:@"fixupViews" context:nil];
    if (_adBannerViewIsVisible) {
        CGRect adBannerViewFrame = [_adBannerView frame];
        adBannerViewFrame.origin.x = 0;
        adBannerViewFrame.origin.y = 0;
        [_adBannerView setFrame:adBannerViewFrame];
        CGRect contentViewFrame = _contentView.frame;
        contentViewFrame.origin.y = 
        [self getBannerHeight:[UIApplication sharedApplication].statusBarOrientation];
        contentViewFrame.size.height = self.view.frame.size.height - 
        [self getBannerHeight:[UIApplication sharedApplication].statusBarOrientation];
        _contentView.frame = contentViewFrame;
    } else {
        CGRect adBannerViewFrame = [_adBannerView frame];
        adBannerViewFrame.origin.x = 0;
        adBannerViewFrame.origin.y = 
        -[self getBannerHeight:[UIApplication sharedApplication].statusBarOrientation];
        [_adBannerView setFrame:adBannerViewFrame];
        CGRect contentViewFrame = _contentView.frame;
        contentViewFrame.origin.y = 0;
        contentViewFrame.size.height = self.view.frame.size.height;
        _contentView.frame = contentViewFrame;            
    }
    [UIView commitAnimations];
  }   
 }

Upvotes: 0

Views: 1247

Answers (1)

aroth
aroth

Reputation: 54806

I believe this reference will solve your problem:

http://useyourloaf.com/blog/2010/11/27/iad-framework-updates-for-ios-42.html

In a nutshell, ADBannerContentSizeIdentifier480x32 and ADBannerContentSizeIdentifier320x50 were deprecated some time ago, and you should be using ADBannerContentSizeIdentifierLandscape and ADBannerContentSizeIdentifierPortrait instead.

Upvotes: 2

Related Questions