尝试实现时出现iAD错误

时间:2012-02-09 07:06:26

标签: objective-c ios xcode

我正在关注如何将iAd合并到我的应用程序中的教程,但到目前为止这是一个很难的事。本教程结合了使用ios 3.0的用户可能遇到问题的事实。它可以在这里找到:http://www.raywenderlich.com/1371/how-to-integrate-iad-into-your-iphone-app

这些是我的PROJECT的构建设置:

架构:armv6 armv7 基础SDK:最新的iOS(iOS 5.0) 仅构建活动架构:否 有效架构:armv6 armv 7

TARGETS的构建设置:

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

提前谢谢你,一直试图找到答案!

这是我得到的错误:

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)

//在我的.m文件中

      - (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];
  }   
 }

1 个答案:

答案 0 :(得分:2)

我相信这个参考资料可以解决您的问题:

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

简而言之,ADBannerContentSizeIdentifier480x32ADBannerContentSizeIdentifier320x50不久前已被弃用,您应该使用ADBannerContentSizeIdentifierLandscapeADBannerContentSizeIdentifierPortrait代替。