When I add AdMobSDK to Xcode project,
Apple Mach-O Linker error occur.

I have this code.

MainViewController.m

#define BANNER_UNIT_ID @"ca-app-pub-79429573xxxxxxxx/78xxxxxxxx"
@interface MainViewController ()
@property (nonatomic) GADBannerView* bannerView_;
@property (nonatomic, strong) UIView *myView;

@end
@implementation MainViewController
@synthesize myView;

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setUpMyView];
}

- (void)setUpMyView
{
    myView = [[UIView alloc]initWithFrame:CGRectMake(0, 60, 320, 508)];
    myView.opaque = NO;
    myView.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.0f];
    [self.view addSubview:myView];

    self.bannerView_ = [[GADBannerView alloc]initWithAdSize:kGADAdSizeBanner];
    self.bannerView_.adUnitID = BANNER_UNIT_ID;
    self.bannerView_.rootViewController = self;
    [myView addSubview:self.bannerView_];
    [self.bannerView_ loadRequest:[GADRequest request]];
}

And I add following frameworks.

AdSupport
AudioToolbox
AVFoundation
CoreGraphics
MessageUI
StoreKit
SystemConfiguration

Then following errors occur.

Apple Mach-O Linker error:
"_OBJC_CLASS_$_CTTelephonyNetworkInfo", referenced from:
linker command failed with exit code 1 (use -v to see invocation)

How do I fix it?

Thank you.

有帮助吗?

解决方案

You have not included the CoreTelephony framework in your application, which Admob requires. The documentation provides information on how to do this.

https://developers.google.com/mobile-ads-sdk/docs/#ios

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top