I am trying to use the Google AdMob SDK, and with all the information out there and how simple it seems to be, I am actually having some trouble getting going.
I am following this tutorial, but on my own project (not the sample one). I am using the latest iOS SDK (6.2.1). All seems fine, but when I add the "-ObjC" flag to my
Other Code Signing Flags
, it throws an error:(null): codesign: invalid option -- O
Now, this only happens when I try and debug the app on my jailbroken device (iOS 6.0.1, 4th generation iPod). I accepted this error since I did not buy a developer license, but I continue having trouble even with the simulator.
I now add back the -ObjC flag to the
Other Code Signing Flags
, and I compile and build with iOS 6.0 iPhone simuilator. All is fine, and it runs (no code yet). I then add#import "GADBannerView.h"
to my header, and also add a property (@property (nonatomic) GADBannerView *bannerView;
) as well as@synthesize
it. Then I add this code to my.m
file:- (void) viewDidLoad { [super viewDidLoad]; // ad setup self.bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner]; self.bannerView.adUnitID = @"********"; // <- I have my correct one here. self.bannerView.rootViewController = self; [self.view addSubview:self.bannerView]; [self.bannerView loadRequest:[GADRequest request]]; }
Add it manages to throw an exception and crash on the last line there (
[self.bannerView loadRequest:[GADRequest request]];
). The full message:2012-12-25 23:33:00.392 NFL Scores[39359:c07] -[GADObjectPrivate changeState:]: unrecognized selector sent to instance 0xa1a2540 2012-12-25 23:33:00.394 NFL Scores[39359:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GADObjectPrivate changeState:]: unrecognized selector sent to instance 0xa1a2540' *** First throw call stack: (0x1b32012 0x16e5e7e 0x1bbd4bd 0x1b21bbc 0x1b2194e 0x1f792 0x2103e 0x1ed47 0x37ec 0x937817 0x937882 0x937b2a 0x94eef5 0x94efdb 0x94f286 0x94f381 0x94feab 0x94ffc9 0x950055 0xa553ab 0x8a692d 0x16f96b0 0x7001fc0 0x6ff633c 0x7001eaf 0x9458cd 0x88e1a6 0x88ccbf 0x88cbd9 0x88be34 0x88bc6e 0x88ca29 0x88f922 0x939fec 0x886bc4 0x886dbf 0x886f55 0x88ff67 0x853fcc 0x854fab 0x866315 0x86724b 0x858cf8 0x197cdf9 0x197cad0 0x1aa7bf5 0x1aa7962 0x1ad8bb6 0x1ad7f44 0x1ad7e1b 0x8547da 0x85665c 0x2a5d 0x2985 0x1) libc++abi.dylib: terminate called throwing an exception
Why is this? Everything that I have seen suggests to add the
-all_load
and/or-ObjC
flag, but neither seem to work. Thanks in advance.
EDIT: For whatever reason, I am on Xcode 4.5.2
.