views:

448

answers:

1

I want to integrate AdMob ads in my iPhone app. I'm using IB way to add the view and follow AdMob's pdf guide:

1. Add AdMob group(AdMobView.h,AdMobDelegateProtocol.h,libAdMob.a)
2. Add required frameworks(AudioToolbox,MediaPlayer,MessageUI,QuartzCore)
3. Add TouchJSON group
4. Add IBSupport group(AdViewController.h,AdViewController.m)
5. Add a 320*48 UIView in IB, add NSObject and change its class to AdViewController,
link AdViewController's view to the 320*48 UIView and link AdViewController's viewController to current view controller.

Now the iPhone simulator can show ads from AdMob, but when I test it on real device, I get the error "AdMob: Did fail to receive ad".

I've tried to add test device's UDID to testDevices array, but still get the same error.

- (NSArray *)testDevices {
    return [NSArray arrayWithObjects: ADMOB_SIMULATOR_ID, DEVICE_UDID, nil];
}

Is there any problem in the above steps? Does anybody know why can't I get the ads in real device? By the way, what should be changed to build for real for-sale app, not just for test?

A: 

Setting testDevices seems not working for my test device. I've added a deprecated method -(BOOL)useTestAd according to AdMob wiki and it works now.

- (BOOL)useTestAd {
    return NO;
}
iPhoney