如何在iPhone 3.1.3模拟器上运行通用应用程序? [英] How do I run a universal app on the iPhone 3.1.3 simulator?

查看:137
本文介绍了如何在iPhone 3.1.3模拟器上运行通用应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款我希望在iPhone和iPad上普及的新应用。我开始使用创建基于窗口的应用程序向导,并在iPhone和iPad组中创建了单独的应用程序代理。由于我已经非常熟悉iPhone开发,我做了我项目的那部分,现在我已经准备好做一些iPad的东西了。

I'm working on a new app that I want to be universal for the iPhone and iPad. I started out with the "Create a Window-based app" wizard, and it created separate app delegates in "iPhone" and "iPad" groups. Since I already was quite familiar with iPhone dev, I did that part of my project, and now I'm ready to do some iPad stuff.

所以...我首先将UISplitViewController添加到我的iPad委托,将Active SDK切换到3.2,然后就可以了!但是当我切换回3.1.3并尝试在模拟器中运行它时,Build and Go失败了。对于初学者,我看到:

So... I started out by adding a UISplitViewController to my iPad delegate, switch the Active SDK to 3.2, and it works! But when I switch back to 3.1.3, and try to run it in the simulator, Build and Go fails. For starters, I see:


... path ... / iPad / AppDelegate_Pad.h:13:错误:期望说明符限定符 - 'UISplitViewController'之前的列表

...path.../iPad/AppDelegate_Pad.h:13: error: expected specifier-qualifier-list before 'UISplitViewController'

我的Base SDK设置为3.2,部署目标设置为3.1.3。我觉得这就够了。但我也在文档中发现了这种方法有条件地编译:

I've got my Base SDK set to 3.2 and my Deployment Target set to 3.1.3. I thought that was enough. But I also have found in the documentation this method to conditionally compile:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
   MyIPadViewController* vc;
// Create the iPad view controller
#else
   MyIPhoneViewController* vc;
// Create the iPhone view controller
#endif

所以我需要到处都这样做?这似乎是一个非常多的代码(无论如何我将在4.0的短时间内摆脱)所以我觉得我必须做错事。而且,我甚至不知道它如何适用于@property或@synthesize声明之类的东西。

So do I need to do this everywhere? It seems like an awful lot of code to add (that I'll be getting rid of in a short time for 4.0 anyway) so I feel like I must be doing something wrong. And, I don't even have any idea how this works for things like @property or @synthesize declarations.

tl;问题的博士版本 - 我错过了某个地方的设置吗?

tl;dr version of the question - did I miss a setting somewhere?

推荐答案

恰恰相反。通用应用程序在iPhone和iPad上运行相同的二进制文件,因此您无法使用条件编译来区分这两个版本。但是您需要在文档中使用宏Apple引用:

Quite the opposite. A universal app runs the same binary on iPhone and iPad so you cannot use conditional compilation to differentiate between the two version. But you need to use the macro Apple cites in the documentation:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    // iPad-specific code
} else {
    // iPhone-specific code
}

这篇关于如何在iPhone 3.1.3模拟器上运行通用应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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