@interface ViewController : UIViewController<Notify, GADInterstitialDelegate, GADBannerViewDelegate,AVPlayerViewControllerDelegate, KYDrawerControllerDelegate, PlayerFinishListener, MobizDelegate, PlayerDelegate, BlueKaiOnDataPostedListener/*, CLLocationManagerDelegate*/>
@property(nonatomic, strong) DFPInterstitial *interstitial;
@end
@implementation ViewController
- (void)viewDidLoad {
[self createAndLoadInterstitial];
}
- (void)createAndLoadInterstitial {
self.interstitial = [[DFPInterstitial alloc] initWithAdUnitID:[[AppData sharedInstance] dataConfiguration].adsAdmin.generalAdUrl];
[self.interstitial setDelegate:self];
DFPRequest *request = _currentItem != nil ? [Utilities generateRequestWithTargetingDictionary:_currentItem] : [DFPRequest request];
[self.interstitial loadRequest:request];
}
Later this method is being called:
- (void)showInterstitial {
if (self.interstitial.isReady) {
[self.interstitial presentFromRootViewController:self];
} else {
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(showInterstitialAfterTimer:) userInfo:nil repeats:NO];
}
}
- (void)showInterstitialAfterTimer: (NSTimer *)timer {
[self showInterstitial];
}
-(void)interstitialDidDismissScreen:(GADInterstitial *)ad{
_shouldHideStatusBar = NO;
[self createAndLoadInterstitial];
}
I'll appreciate your help.