简体   繁体   English

如何让Xcode将Info.plist视为iPhone / iPad Info.plist?

[英]How do I get Xcode to treat an Info.plist as an iPhone/iPad Info.plist?

I have two cocoa-touch apps in one Xcode project. 我在一个Xcode项目中有两个可可触摸应用程序。 Xcode gives me iPhone/iPad related options for keys in the first's Info.plist, such as "Launch Image (iPad)". Xcode为我提供了第一个Info.plist中键的iPhone / iPad相关选项,例如“Launch Image(iPad)”。 But, Xcode gives me Mac OS X options for keys for the second, such as "Java classpaths" and "Quick Look preview height." 但是,Xcode为我提供了第二个键的Mac OS X选项,例如“Java classpaths”和“Quick Look preview height”。

Here's how the project was built: 以下是项目的构建方式:

I created the new project as a Universal Window-based Application using Xcode, which came with a default Info.plist that translates raw plist keys like UIPrerenderedIcon to more human readable values like "Icon already includes gloss effects." 我使用Xcode创建了一个基于通用窗口的应用程序的新项目,该应用程序带有一个默认的Info.plist,它将UIPrerenderedIcon等原始plist键转换为更多人类可读的值,如“Icon已包含光泽效果”。 All good. 都好。

In the same Xcode Project, I added a second target, also a Cocoa-Touch application, and built it from scratch, including the Info.plist file. 在同一个Xcode项目中,我添加了第二个目标,也是一个Cocoa-Touch应用程序,并从头开始构建它,包括Info.plist文件。

I've opened up the "Active Target" project settings for both apps and have exactly one "Setting Defined at This Level": Product Name . 我已经打开了两个应用程序的“Active Target”项目设置,并且只有一个“在此级别定义的设置”: 产品名称 At the higher "Project Settings" level, no Product Name is defined and the Info.plist File is defined as ${EXECUTABLE_NAME}/${EXECUTABLE_NAME}-Info.plist . 在较高的“项目设置”级别,未定义任何产品名称 ,并且Info.plist文件定义为${EXECUTABLE_NAME}/${EXECUTABLE_NAME}-Info.plist (Other settings, like Prefix Header , are similarly defined with variable substitution.) (其他设置,如前缀标题 ,类似地使用变量替换定义。)

Both apps build, run and use their respective Info.plist files appropriately, but Xcode still tries to give me Mac OS X Info.plist values when editing the second app's Info.plist. 两个应用程序都适当地构建,运行和使用各自的Info.plist文件,但在编辑第二个应用程序的Info.plist时,Xcode仍然试图给我Mac OS X Info.plist值。

How can I tell Xcode that the plist should be an iPad/iPhone Info.plist, not a Mac OS X Info.plist? 如何告诉Xcode plist应该是iPad / iPhone Info.plist,而不是Mac OS X Info.plist?

Try this: select/open the Info.plist in question, and then from the menu, do 试试这个:选择/打开有问题的Info.plist,然后从菜单中选择

View > Property List Type > iPhone Info.plist 查看>属性列表类型> iPhone Info.plist

for Xcode 5 there's no View -> Property List Type so the solution is to open the file, right click anywhere in it and right under Show Raw Keys/Values you'll find the Property List Type menu. 对于Xcode 5,没有View - > Property List Type因此解决方案是打开文件,右键单击其中的任何位置,然后在Show Raw Keys/Values您将找到Property List Type菜单。

Happy coding, Z. 快乐的编码,Z。

I'm also curious about this. 我也很好奇。 I ran into the same thing while upgrading an iPhone project for iPad, and after days of trying to figure it out, I just made a new project and reimported the custom classes. 我在升级iPad的iPhone项目时遇到了同样的问题,经过几天的尝试,我刚刚创建了一个新项目并重新导入了自定义类。 I upgraded the target and this time the keys were still for iOS. 我升级了目标,这次密钥仍然适用于iOS。

My best guess is this is an XCode bug. 我最好的猜测是这是一个XCode错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM