一个 XCode 项目,两个目标,两个应用程序(iPhone/iPad)不是通用应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4946988/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
One XCode project, two target, two apps (iPhone/iPad) not universal app
提问by clide313
We have an XCode project that was first build as an universal app, and then on the road we changed our mind on having the two app in the same binary, so we created two targets.
我们有一个 XCode 项目,它首先被构建为一个通用应用程序,然后在路上我们改变了将两个应用程序放在同一个二进制文件中的想法,所以我们创建了两个目标。
- The first one is called: AppName and is for iPhone: the base SDK is 4.2 and deployment target is 3.1.3. Targeted Device is iPhone.
- The second is called: AppNameHD and is for iPad: the base SDK is 3.2 and targeted device is iPad.
- 第一个称为:AppName,适用于 iPhone:基础 SDK 为 4.2,部署目标为 3.1.3。目标设备是 iPhone。
- 第二个称为:AppNameHD,适用于 iPad:基础 SDK 为 3.2,目标设备为 iPad。
It's been a few weeks now we are easily building for each of those platform and able to deploy on the both iPad and iPhone.
几周过去了,我们可以轻松地为每个平台构建,并且能够在 iPad 和 iPhone 上进行部署。
Now we are ready to submit to the app store and i'm worried about potential rejection of the code. We want to submit the iPad only app for now, but i've looked around there is nowhere in the itunesconnect site i can specify the targeted device, and as the project was structured first to be an universal app. I'm wondering how they determine on which device to test the binary.
现在我们准备提交到应用程序商店,我担心代码可能会被拒绝。我们现在想提交仅限 iPad 的应用程序,但我环顾四周,itunesconnect 站点中没有任何地方我可以指定目标设备,因为该项目首先被构建为一个通用应用程序。我想知道他们如何确定在哪个设备上测试二进制文件。
More informations about the architecture: We are using the default generated info.plist file for both targets. Should we have a separate info.plist for each of the target? what differences should be present between the two .plist files.
有关架构的更多信息:我们为两个目标使用默认生成的 info.plist 文件。我们应该为每个目标设置一个单独的 info.plist 吗?两个 .plist 文件之间应该存在哪些差异。
Here is attached the actual info.plist file we are using.
这里附上了我们正在使用的实际 info.plist 文件。
Thanks for your help in advance.
提前感谢您的帮助。
采纳答案by Bogatyr
First of all, there's no reason why your base SDK for the ipad only target should be 3.2. In fact, since iOS 4.2 runs on ipad, you're going to limit your customer base by not changing the base SDK to 4.2. You can set your target OS to iOS 3.2 to make sure the app will run on iOS 3.2.
首先,没有理由为 ipad 专用目标的基本 SDK 应该是 3.2。事实上,由于 iOS 4.2 在 ipad 上运行,您将通过不将基础 SDK 更改为 4.2 来限制您的客户群。您可以将目标操作系统设置为 iOS 3.2,以确保应用程序将在 iOS 3.2 上运行。
In your target configuration build settings, look for "targeted device family", that will say whether or not the target is "ipad", "iphone" or (for universal apps) "iphone/ipad".
在您的目标配置构建设置中,查找“目标设备系列”,它会说明目标是“ipad”、“iphone”还是(对于通用应用程序)“iphone/ipad”。
I also migrated a universal app to two separate targets -- it was not fun. You have to very carefully check your build settings and your .plist files to make sure they're sane for their intended target device, especially check:Base SDK, iOS deployment target, targeted device family, and Info.plist file
我还将一个通用应用程序迁移到两个不同的目标——这并不有趣。您必须非常仔细地检查您的构建设置和 .plist 文件,以确保它们对于预期的目标设备是健全的,尤其是检查:Base SDK、iOS 部署目标、目标设备系列和 Info.plist 文件
回答by ohho
Should we have a separate info.plist for each of the target?
我们应该为每个目标设置一个单独的 info.plist 吗?
- Yes.
- 是的。
What differences should be present between the two .plist files?
两个 .plist 文件之间应该存在哪些差异?
- Bundle identifier (e.g.,
com.example.app
for iPhone/iPod andcom.example.app-hd
for iPad) - (optional) icon (different for iPhone, iPhone @2x and iPad)
- (optional) Launch image (different for iPhone, iPhone @2x and iPad)
- (optional) Supported interface orientations (in my experience, at least 2 orientations for iPad)
- 捆绑标识符(例如,
com.example.app
用于 iPhone/iPod 和com.example.app-hd
iPad) - (可选)图标(iPhone、iPhone @2x 和 iPad 不同)
- (可选)启动图像(iPhone、iPhone @2x 和 iPad 不同)
- (可选)支持的界面方向(根据我的经验,iPad 至少有 2 个方向)
回答by loafoe
Apple uses your Info.plist to determine the target(s) in itunesconnect.
Apple 使用您的 Info.plist 来确定 itunesconnect 中的目标。
Looking at your screenshot I think you just need to make sure you do not specify the NSMainNibFile~ipad an UISupportedInterfaceOrientations~ipad in the iPhone target and visa versa for the iPad target (i.e. do not include iPhone specific entries). BTW, opening the Info.plist in Xcode provides much more descriptive names for the keys and also provides a dropdown for the allowed values.
看看你的截图,我认为你只需要确保你没有在 iPhone 目标中指定 NSMainNibFile~ipad 和 UISupportedInterfaceOrientations~ipad,反之亦然为 iPad 目标(即不包括 iPhone 特定条目)。顺便说一句,在 Xcode 中打开 Info.plist 为键提供了更多描述性的名称,还提供了允许值的下拉列表。
Also be careful with UIRequiredDeviceCapabilities i.e. as a general rule only include a key in your plist if it's absolutely needed.
还要小心 UIRequiredDeviceCapabilities 即作为一般规则,如果绝对需要,只在你的 plist 中包含一个键。
回答by kiran
To use an IPhone app in iPad, launch image is not getting, solution:
在 iPad 中使用 iPhone 应用程序时,无法获取启动图像,解决方法:
Select "Don't Use Assets Catalog" for launch images in General settings. Add,
在常规设置中为启动图像选择“不使用资产目录”。添加,
- [email protected] (640x960)
- [email protected] (640x1136)
- Default.png (640x960) don't use (320x480)
- 默认@2x.png (640x960)
- 默认[email protected] (640x1136)
- Default.png (640x960) 不使用 (320x480)