开发者

How can I make Info.plist show English names?

开发者 https://www.devze.com 2023-01-06 06:35 出处:网络
I have a project with two Info.plist开发者_运维问答 files (one for each target). In the second Info.plist, when I add a field it shows the internal name instead of the English name. For example UISupp

I have a project with two Info.plist开发者_运维问答 files (one for each target). In the second Info.plist, when I add a field it shows the internal name instead of the English name. For example UISupportedInterfaceOrientations instead of "Supported Interface Orientations".

Also, when I click on the dropdown list to see all options, some of the options that are available in the first .plist file are not in the second (eg CFBundleIconFiles). The two problems are really the same thing (anything which shows the internal name does not appear in the dropdown).

The Bundle Verion is 1.1 in both files, the CFBundleInfoDictionaryVersion are both the same, as are the plist version and the DTD.

What's stopping the second plist from giving me these options? Thanks.

alt text http://img.skitch.com/20100708-ctia2e6yfwgd7twdnepryidayr.jpg


Xcode has a couple of different editors to show the contents of plist files. One of them is the generic plist editor, which shows the names of the keys without translation. The plist editor can also be in the specialized Info.plist mode, where it knows about the structure of this special type of plist file and translates keys to english.

I don't know how Xcode decides which editor to use, so the following is just guessing: I assume Xcode looks into the selected target to check the path to the Info.plist file and if it is the edited file, uses the specialized editor. So if you have one target selected, but open the other targets Info.plist it might use the generic editor instead.

Xcode also manages file types for each file in the project. You can override Xcode's automatic guesses by opening the file's settings (click on the file in the outline view and press command-I). Maybe there's a file type to identify Info.plist files.

As a last resort, you can always open the file by right clicking it in the outline view. In the context menu from "Open as ..." you can choose how to open it. I usually use "Source Code File" since I like to see the original XML.


Typically, there are times when not all options are shown. If you know it is supposed to exist, you can just add the key (via copy/paste) from the XML file of the other info.plist. I normally just open it up as XML and work in that mode (which gives non-English names).

All keys can be found here: http://developer.apple.com/iphone/library/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html

In the latest XCode, it has been converting everything automatically to English names for me though even when I try to paste as a non-English name in the property list editor.


Short Answer

Select iPhone Info.plist from the View > Property List Type menu.

Explanation

This actually has nothing to do with the plist file itself. It's how Xcode (via the Property List Editor) presents the file.

You can test this by, in Finder, making a copy of a correctly-displaying plist file. Open the copy in the Property List Editor (usually the default application). The copy usually won't display the English names (until you change the Property List Type).

Xcode will remember the type you select and save it in the .xcodeproj file.

0

精彩评论

暂无评论...
验证码 换一张
取 消