在 Xcode 4 中将 plist 根类型更改为数组?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5477797/
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
Change plist root type to Array in Xcode 4?
提问by Keller
In Xcode, I had gotten quite used to creating plists
to store simple arrays of static data.
在 Xcode 中,我已经非常习惯于创建plists
来存储简单的静态数据数组。
However, in Xcode 4 I can't figure out how to change the default root type of a plist
from Dictionary
to Array
.
但是,在 Xcode 4 中,我不知道如何将 a 的默认根类型plist
从Dictionary
更改为Array
。
Just one of many frustrations I've been having with Xcode 4. Does anyone know how to do this?
这只是我在使用 Xcode 4 时遇到的众多挫折之一。有谁知道如何做到这一点?
回答by Govind
Just right-click the .plist file and open file as source code. Now we will be able to see the xml file.
只需右键单击 .plist 文件并打开文件作为源代码。现在我们将能够看到 xml 文件。
Replace the <dict/>
to <array/>
. Now build the project once. Things will be all right.
替换<dict/>
为<array/>
。现在构建项目一次。事情会好起来的。
回答by Jesse
My technique: create a new row, set its type to array, put the items you want in the root array in it. Cut the array, then you have an empty plist. Then paste, and you have an array with root type of Array, with the items from the array you created.
我的技巧:创建一个新行,将其类型设置为数组,将您想要的项目放在根数组中。剪切数组,然后你有一个空的 plist。然后粘贴,您将拥有一个根类型为 Array 的数组,其中包含您创建的数组中的项目。