Frage

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.

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top