【问题标题】:Admob in iPhone with Tabbar and TableView带有 Tabbar 和 TableView 的 iPhone 中的 Admob
【发布时间】:2010-03-01 15:17:11
【问题描述】:

我有 5 个按钮的标签栏。在 5 个选项卡中,2 个是表视图,它使用导航控制器在单击单元格时显示子视图。 在标签栏上方,在每个视图中,我使用“Admob”为广告留出了一些空间。 我正在使用 IB 添加广告。 但是当它到达“adMobAd = [AdMobView requestAdWithDelegate:self];”时它会给出 EXC_BAD_ACCESS在 AdViewController.m 中

我正在使用以下代码行将视图添加到标签栏视图。在我的代码中,我只是将广告添加到 LatestNews。谁能帮我解决这个问题。

UINavigationController *localNavigationController;

// create tab bar controller and array to hold the view controllers
tabBarController = [[UITabBarController alloc] init];
NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:5];

// setup the first view controller (Root view controller)
LatestNews* latestNewsController;
latestNewsController = [[LatestNews alloc] initWithTabBar];



 // create the nav controller and add the root view controller as its first view
  localNavigationController = [[UINavigationController alloc] initWithRootViewController:latestNewsController];

  // add the new nav controller (with the root view controller inside it)
  // to the array of controllers
  [localControllersArray addObject:localNavigationController];

  // release since we are done with this for now
  [localNavigationController release];
  [latestNewsController release];

  // setup the second view controller just like the first
  Forums* forumsController;
  forumsController = [[Forums alloc] initWithTabBar];

  localNavigationController = [[UINavigationController alloc] initWithRootViewController:forumsController];
  [localControllersArray addObject:localNavigationController];
  [localNavigationController release];
  [forumsController release];

 RecipeList* recipesController = [[RecipeList alloc] initWithTabBar];
 localNavigationController = [[UINavigationController alloc] initWithRootViewController:recipesController];
 [localControllersArray addObject:localNavigationController];
 [localNavigationController release];
 [recipesController release];

 //Setup Connect view
 Connect* cnt = [[Connect alloc] initWithTabBar];
 [localControllersArray addObject:cnt];
 [cnt release];

 //Setup Subscribe View
 Subscribe* scribe = [[Subscribe alloc] initWithTabBar];
 [localControllersArray addObject:scribe];
 [scribe release];

  // load up our tab bar controller with the view controllers
  tabBarController.viewControllers = localControllersArray;

  [localControllersArray release];
  [window addSubview:tabBarController.view];
  [window makeKeyAndVisible]; 

【问题讨论】:

  • 您声明当您访问 AdMobView 时您的应用程序崩溃了,但上述代码均未显示您如何设置此视图。否则,我们无法为您提供具体指导。

标签: iphone uitableview admob ads-api uitabview


【解决方案1】:

EXC_BAD_ACCESS 可能是因为控制器中的广告视图设置为 nil。

检查您是否已将 Interface Builder 中的 AdMob 视图附加到视图控制器中的视图属性。

【讨论】:

    猜你喜欢
    • 2012-01-06
    • 1970-01-01
    • 1970-01-01
    • 2011-06-16
    • 1970-01-01
    • 2010-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多