2013-10-21 234 views
4

我有一個基於標籤視圖的iOS應用程序,我想使用AdMob GADInterstitial。admob插頁式廣告presentFromRootViewController不顯示廣告

 if (gadFullReady) { //this check if GAD interstitial received ad 
      NSLog(@"from GAD"); 
      [gadFull presentFromRootViewController:self]; 
     } 

沒有AdMob插頁顯示了,我得到錯誤信息,如:

 Warning: Attempt to present <GADWebAppViewController: 0x9965bd0> on <UITabBarController: 0xb24ab00> while a presentation is in progress! 

看來我的當前視圖控制器呈現的東西,所以我去檢查不管它是什麼,並關閉它。

  NSLog(@"above view %@", [[self presentedViewController] description]); 
      UIViewController *currVC = [self presentedViewController]; 
      [currVC dismissViewControllerAnimated:NO completion:^(){ 
       [gadFull presentFromRootViewController:self]; 
      }]; 

這一次,我得到了錯誤信息:

 above view <UINavigationController: 0x99cbbe0> 
     Warning: Attempt to dismiss from view controller <UITabBarController: 0x9992890> while a presentation or dismiss is in progress! 

任何人知道爲什麼嗎? TIA!

回答

0
- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    _iSel=0; 
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0f) self.tableView.tintColor = kIHLightColor; 
    [self.tableView setContentOffset:CGPointMake(0, -20)]; 
    [self.tableView setContentInset:UIEdgeInsetsMake(20, 0, 0, 0)]; 

    self.tableView.backgroundColor = kIHMenuCellBackgroundColor; 
} 

- (void)viewWillAppear:(BOOL)animated 
{ 
    [super viewWillAppear:animated]; 
    [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:_iSel inSection:0] 
           animated:NO 
          scrollPosition:UITableViewScrollPositionNone]; 
} 

保存選擇值