【问题标题】:crash in app, after iAd id added添加 iAd id 后,应用程序崩溃
【发布时间】:2013-11-07 20:38:10
【问题描述】:

我已将 iAd 添加到我的应用程序中。它运行良好,但是当 ViewController 被关闭时,应用程序崩溃。 iAd 和委托对象设置为 nil(在我们关闭控制器之后),所以这里没有问题。

我正在添加这样的 iad,并实现了所有委托方法

self.adBannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];
self.adBannerView.frame = CGRectMake(0, 710, 1024, 66);
self.adBannerView.delegate = self;
[self.view addSubview:adBannerView];

我在线路上收到 EXC_BAD_ACCESS

int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");

【问题讨论】:

  • 首先你可以用一个替换前两行:self.adBannerView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 710, 1024, 66)]。你应该给我们一些崩溃日志。
  • Tom 是对的,但您使用 retVal 的原因是什么?
  • 我没有使用。它在 AppDelegate 文件中的默认代码。
  • 请在抛出异常时添加断点。然后你可能会看到一些更有趣的错误日志。转到Breakpoint Navigator > Plus/Add > Add Exception Breakpoint

标签: ios iphone ipad iad


【解决方案1】:

确保包含 iAdFramework 和 AdSupportFrameworks..

转到您的目标 > 构建阶段 > 将二进制文件与库链接

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多