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.
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?
Thanks!
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.
I'm not sure what Apple is going to do when one can develop both iPhone and iPad apps for version 4.0 , but right now, if you want to test in the simulator for either do the following:
- For testing as an iPhone app set the Simulator to version 3.1.3
- For testing as an iPad app set the Simulator to version 3.2
This is how XCode/the iPhone Simulator currently determine which simulation to run.
来源:https://stackoverflow.com/questions/2704148/combining-iphone-ipad-apps-into-one-universal-app