将iPhone / iPad应用程序组合到一个通用应用程序中

将iPhone / iPad应用程序组合到一个通用应用程序中

问题描述:

我有两个应用程序(一个用于iPhone,另一个用于iPad),我想将它们合并到一个通用应用程序中。对于我的第一次尝试,我尝试创建一个新的通用应用程序项目,并为iPhone和iPad版本添加了库。 iPad版本已编译并运行正常(如预期),但iPhone版本没有。我的希望是我可以创建一个通用应用程序,在iPhone上运行时只执行iPhone库中的项目,反之亦然执行iPad。

I have two apps (one for the iPhone, the other for the iPad) that I'd like to combine into one universal app. For my first attempt, I tried creating a new universal app project and added the libraries for the iPhone and iPad versions. The iPad version compiled and ran fine (as expected), but the iPhone version didn't. My hope was that I could create a universal app that would execute only the project in the iPhone library when running on the iPhone and vice versa for the iPad.

看起来像这应该仍然有效。有没有办法告诉通用应用程序项目在编译iPad时忽略其中一个外部库,反之亦然?

It seems like this should still work. Is there a way to tell the universal app project to ignore one of the external libraries when compiling for the iPad and vice versa for the iPhone?

谢谢!

在通用应用程序中,只有一个二进制文件。你没有为iPad编译,反之亦然。两个设备都运行相同的代码。所有关于做什么和加载什么的决定都必须在运行时做出。

In a universal app there is only one binary. You do not "compile for the iPad and vice versa for the iPhone". Both device run the same code. All decisions on what to do and what to load have to be made at runtime.