Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top