GADInterstitialDelegate & IMInterstitialDelegate have the same function name: interstitialDidReceiveAd
//inmob
- (void)interstitialDidReceiveAd:(IMInterstitial *)ad
//callback:(id<IMInterstitialDelegate>)callback
{
[ad presentInterstitialAnimated:YES];
NSLog(@"!!! inmob interstitialDidReceiveAd ok ");
}
// Sent when an interstitial ad request failed
- (void)interstitial:(IMInterstitial *)ad didFailToReceiveAdWithError:(IMError *)error
//callback:(id<IMInterstitialDelegate>)callback
{
NSLog(@"!!! inmob didFailToReceiveAdWithError ");
// NSString *errorMessage = [NSString stringWithFormat:@"Loading ad (%@) failed. Error code: %d, message: //%@", [self.detailItem objectForKey:@"title"], [error code], [error localizedDescription]];
//NSLog(@"%@", errorMessage);
}
//admob
- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitialAdmob
{
NSLog(@"!!! admob interstitialDidReceiveAd ok");
}
- (void)interstitial:(GADInterstitial *)interstitial
//callback:(id<GADInterstitialDelegate>)callback
didFailToReceiveAdWithError:(GADRequestError *)error
{
NSLog(@"!!!!!!! admob interstitial error!");
}
Build error: Duplicate declaration of method 'interstitialDidReceiveAd:'
Objective-C doesn't allow multiple methods with the same name but accepting different types. Luckily it is also weakly typed. So you should be able to get away with:
- (void)interstitialDidReceiveAd:(id)interstitial
{
if([interstitial isKindOfClass:[GADInterstitial class]])
[self admobInterstitialDidReceiveAd:interstitial];
else
[self inmobiInterstitialDidReceiveAd:interstitial];
}
Or any such more thorough test based on receiving an id
and checking its type when it arrives.