如何使 iAds 在 3.0 上运行iPhone-iPad 应用程序?

发布于 2024-09-16 04:24:10 字数 379 浏览 0 评论 0原文

我为 iPhone-iPad 创建了一个通用应用程序。我目前只负责 iPhone 部分。在 iPhone 视图控制器的头文件中,我导入 adbanner 标头并创建一个具有匹配属性的 adbannerview 变量。我不在 nib 文件中创建它,而是在运行时检查该类是否存在,如果存在,我会以编程方式创建一个 adbanner,然后将 adbannerview 变量附加到它,以便我可以在其他函数中引用它。一切都在 4.0 模拟器上运行。我还弱链接了 iad 类。

因此,如果我将相同的代码应用于早期版本的 xcode 并尝试使用 3.0 sim 运行,它会给出所有这些错误,提示我无法导入标头并创建 adbannerview 变量和属性,我该如何解决这个问题?

谢谢。如果您需要更多详细信息或我的代码,请询问。

I created a universal app for the iPhone-iPad. I'm only working on the iPhone part at the moment. In the header file for the view controller for the iPhone one, I import the adbanner header and create an adbannerview variable with a matching property. I don't make it in the nib file but rather check at run time if the class exists, if it does, I create an adbanner programmily and then attach the adbannerview variable to it so I can refer to it inside other functions. Everything works on the 4.0 simulator. I also weak linked the iad class.

So if I take the same code to an earlier version of xcode and try to run using the 3.0 sim, it gives all these errors saying I can't import the header and make the adbannerview variable and the property, how do I get around this?

Thanks. If you need more details or my code, just ask.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

゛时过境迁 2024-09-23 04:24:10

AdLib 框架和 iAds 仅在 iOS 中可用 > 4.0。例如,请参阅 ADBannerView 文档:

可用性 适用于 iOS 4.0 和
稍后。

如果您尝试在旧版本的 sdk 上构建应用程序(而不仅仅是在旧设备上运行二进制文件),并且当您尝试导入标头(如您的问题所示)时遇到错误,您可以尝试包装失败的导入在 #ifdef 指令中测试 Availability.h 中的可用性宏,如下所示:

#ifdef __IPHONE_4_0
  // iOS 4 specific imports here
#endif

The AdLib Framework and iAds are only available in iOS > 4.0. For example, see the docs for ADBannerView:

Availability Available in iOS 4.0 and
later.

If you are trying to build the app on an older version of the sdk (not just run the binary on a older device) and are getting errors when you try to import the headers like your question suggests, you could try wrapping the imports that fail in a #ifdef directive that tests for the availability macros from Availability.h, something like:

#ifdef __IPHONE_4_0
  // iOS 4 specific imports here
#endif
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文