使用iAd框架的通用iPhone / iPad项目 [英] Universal iPhone/iPad project with iAd framework

查看:219
本文介绍了使用iAd框架的通用iPhone / iPad项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置支持iAd的Universal项目(仅限iPhone应用程序)?

how can I set up a Universal project which has support for iAd (just in the iPhone app)?

使用iPhone SDK 4,假设我这样做了以下步骤:

Using the iPhone SDK 4, let's suppose I do the following steps:


  1. 打开XCode;

  2. 转到文件>新建项目;

  3. 选择基于窗口的应用程序(或其他),选择产品:通用(并在选择项目名称后)。

  1. Open XCode;
  2. Go to File > New Project ;
  3. Select Window-based application (or whatever), choose Product: Universal (and after choose a name for the project).

它会像往常一样用iPhone / iPad组创建一个Universal项目骨架。
现在,我决定在我的iPhone应用程序中集成iAd,所以我执行以下操作:

It will create a Universal project skeleton with iPhone/iPad groups as usual. Now, I decide to integrate iAd in my iPhone App, so I do the following:


  1. 右键单击项目的组称为框架>添加>现有框架...

  2. 选择 iAd.framework >添加

  1. Right-click in the project's group called Frameworks > Add > Existing Frameworks...
  2. Choose iAd.framework > Add

到目前为止,非常好。我可以使用Active Executable简单地构建和运行项目名称 - iPhone模拟器4.0 ,项目运行正常。假设我将Active Executable更改为项目名称 - iPad Simulator 3.2 。尽管iAd.framework仍然在框架中成功引用(没有标记为红色),但应用程序在iPad模拟器中崩溃,我收到以下错误消息:

So far, so good. I can simply Build And Run using the Active Executable as Project Name - iPhone Simulator 4.0 and the project runs OK. Suppose I change the Active Executable to Project Name - iPad Simulator 3.2. Although the iAd.framework is still being referenced in the Frameworks successfully (without being marked with the Red color), the App crashed in the iPad simulator and I get the following error message:

dyld:未加载库:/System/Library/Frameworks/iAd.framework/iAd
引自:/ Users / nexia1 / Library / Application Support / iPhone Simulator / 3.2 / Applications / 8479EE14- 28AA-4628-A668-CCF3FE770628 / Untitled.app /无标题
原因:找不到图像

我可以在这样的通用中使用iAd项目? (即使我只在我的iPhone应用程序中引用它)。

Can I use the iAd in such a Universal project? (even that I only references it in my iPhone app).

提前致谢

推荐答案

你需要弱化链接框架,并在你的代码中询问是否存在类。

You need to weak link the framework, and in your code ask if the classes exist.

Apple也有类似的例子: http://developer.apple.com/iphone/library/samplecode/MailComposer/index .html

Apple has a similar example for this: http://developer.apple.com/iphone/library/samplecode/MailComposer/index.html

这是关于3.0上的应用内邮件表,但仍然在2.x上运行,但你会明白这一点。

It is about the in-app mail sheet on 3.0 while still running on 2.x, but you'll get the point.

这篇关于使用iAd框架的通用iPhone / iPad项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆