Xcode 4.2 中的空设置包

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7162846/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:47:46  来源:igfitidea点击:

Empty Settings Bundle in Xcode 4.2

iphonexcodemacos

提问by Andreas Eriksson

I'm trying to create a settings bundle for my iPhone application.

我正在尝试为我的 iPhone 应用程序创建一个设置包。

However, if I create one, it becomes empty, no root p-list, no disclosure, nothing.

但是,如果我创建一个,它就会变成空的,没有根 p 列表,没有披露,什么都没有。

I've restarted everything and am running out of ideas.

我已经重新启动了一切,并且没有想法了。

Anyone know of this?

有人知道吗?

回答by Yedy

Click on the Settings.bundle file in the left window -> From main menu choose View -> Utilities -> Show FileInspector. Then change fileType to "applicationBundle" = the two missing files will show again under the Settings.bundle.

单击左侧窗口中的 Settings.bundle 文件 -> 从主菜单中选择 View -> Utilities -> Show FileInspector。然后将 fileType 更改为“applicationBundle”=两个丢失的文件将再次显示在 Settings.bundle 下。

回答by JomanJi

For those that can't change the filetype, because it doesn't appear, follow these steps:

对于那些无法更改文件类型,因为它没有出现,请按照下列步骤操作:

  1. Go to your project directory in finder.
  2. Create a folder called "Settings."
  3. Open Text Edit (or any other text editor for that matter)
  4. Type in:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"   "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <!--
       Root.plist
       Preference settings for MyApp
    -->
    <plist version="1.0">
        <dict>
    
        </dict>
    </plist>
    

    4a. Change "MyApp" to your app-name

  5. Save as "Root" in the settings folder
  6. Rename the file to "Root.plist"
  7. Rename the "Settings." Folder to "Settings.bundle"
  8. Add the "Settings.bundle" file to Xcode and you should be good to go :)
  1. 在 finder 中转到您的项目目录。
  2. 创建一个名为“设置”的文件夹。
  3. 打开文本编辑(或任何其他文本编辑器)
  4. 输入:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"   "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <!--
       Root.plist
       Preference settings for MyApp
    -->
    <plist version="1.0">
        <dict>
    
        </dict>
    </plist>
    

    4a. 将“MyApp”更改为您的应用程序名称

  5. 在设置文件夹中另存为“Root”
  6. 将文件重命名为“Root.plist”
  7. 重命名“设置”。文件夹到“Settings.bundle”
  8. 将“Settings.bundle”文件添加到Xcode,你应该很高兴:)

回答by VectorVictor

I'm having exactly the same problem. It seems there's a bug in XCode4. Here's what I did that gets you a Settings bundle at least.

我遇到了完全相同的问题。XCode4 中似乎有一个错误。这就是我所做的,它至少为您提供了一个设置包。

(1) In XCode, select CMD+N to add a new file.

(1) 在XCode中,选择CMD+N添加一个新文件。

(2) From the drop-down, select Resource (as per the 'instructions' that don't work).

(2) 从下拉列表中,选择资源(根据不起作用的“说明”)。

(3) Instead of selecting 'Settings.bundle' - select 'Property List'.

(3) 而不是选择“Settings.bundle” - 选择“属性列表”。

(4) Name your property list Root.plist and save it in a new directory called 'Settings'.

(4) 将您的属性列表命名为 Root.plist 并将其保存在名为“Settings”的新目录中。

(5) Now CMD+N again and select Strings File.

(5) 现在再次 CMD+N 并选择字符串文件。

(6) Call the new strings file 'Root.strings' and save that in the 'Settings' directory as well.

(6) 调用新的字符串文件“Root.strings”并将其保存在“Settings”目录中。

(7) Now, in your directories and files list on the left, highlight both of the new files and press delete (TRUST ME HERE!).

(7) 现在,在左侧的目录和文件列表中,突出显示两个新文件并按删除(在这里相信我!)。

(8) On the delete menu, select 'Remove References Only'.

(8) 在删除菜单上,选择“仅删除引用”。

(9) Now go to Finder and rename the 'Settings' directory to 'Settings.bundle'

(9) 现在转到 Finder 并将“设置”目录重命名为“Settings.bundle”

(10) In XCode again, ALT+CMD+A to add a new file to your project and select the 'Settings.bundle' object from the navigator.

(10) 再次在 XCode 中,ALT+CMD+A 将一个新文件添加到您的项目并从导航器中选择“Settings.bundle”对象。

You will now have a working 'Settings.bundle' BUT the two files will be uninitiated, so you'll have to build them yourself from scratch.

您现在将拥有一个有效的“Settings.bundle”,但是这两个文件将是未初始化的,因此您必须自己从头开始构建它们。

This has worked for me twice now and hopefully, this bug will be fixed in the next maintenance release of XCode4. Hope this helps. V.V.

这已经对我有用了两次,希望这个错误将在 XCode4 的下一个维护版本中修复。希望这可以帮助。VV

回答by nachbar

For XCode 5.1, I had a similar problem. Using "File/Open" in XCode to open Settings.bundle just showed an empty window, with no way to open Root.plist . Right clicking on Settings.bundle in XCode File/Open did not reveal any useful options.

对于 XCode 5.1,我遇到了类似的问题。在 XCode 中使用“文件/打开”打开 Settings.bundle 只显示一个空窗口,无法打开 Root.plist 。在 XCode File/Open 中右键单击 Settings.bundle 没有显示任何有用的选项。

The solution is to find the Settings.bundle in Finder, right-click and select "Show Package Contents", and you will see Root.plist. Just right-click on Root.plist, select XCode from the list of programs, and you will get XCode's Settings editor.

解决办法是在Finder中找到Settings.bundle,右击选择“Show Package Contents”,就会看到Root.plist。只需右键单击 Root.plist,从程序列表中选择 XCode,您将获得 XCode 的设置编辑器。