Xcode 无法打开 Info.plist -- 错误提示“没有这样的文件”

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

Xcode can't open Info.plist -- error says "there is no such file"

xcodexcode4info.plist

提问by Octavia Togami

I switched to Xcode 4 and loaded my project, which worked perfectly in Xcode 3. When I run it, I get an error that says:

我切换到 Xcode 4 并加载了我的项目,它在 Xcode 3 中完美运行。当我运行它时,我收到一条错误消息:

The file “Info.plist” couldn't be opened because there is no such file.

无法打开文件“Info.plist”,因为没有这样的文件。

I have looked at the file in Xcode and it is there. So why can't it be opened?

我在 Xcode 中查看了该文件,它就在那里。那为什么打不开呢?

回答by Joshua Nozzi

That the file exists in your Xcode project folder isn't enough. Have you verified the file is properly referenced in your application target's build settings so it's properly copied into the app bundle? It's not quite the same as a standard resource (ie, it's not made a member of the target in the set of target membership check boxes) but rather a build setting because of its importance in a properly-formatted bundle.

该文件存在于您的 Xcode 项目文件夹中是不够的。您是否已验证在您的应用程序目标的构建设置中正确引用了该文件,以便将其正确复制到应用程序包中?它与标准资源并不完全相同(即,它没有成为目标成员资格复选框集中的目标成员)而是构建设置,因为它在格式正确的包中很重要。

Navigate to the project (select it in the Project navigator), select the application target in the list of targets, then click the Build Settings tab. Under the Packaging section, make sure the "Info.plist File" is properly set to the location/file name.

导航到项目(在项目导航器中选择它),在目标列表中选择应用程序目标,然后单击构建设置选项卡。在“打包”部分下,确保“Info.plist 文件”已正确设置为位置/文件名。

回答by amit gupta

go to targets. right click on the test target. yourProjectTests and delete it

去目标。右键单击测试目标。yourProjectTests 并删除它

回答by Genki

For me the problem was that some of the .storyboard files had different deployment targets after a merge. Fixed it by setting all the storyboard files to use "Project Deployment Target". enter image description here

对我来说,问题是一些 .storyboard 文件在合并后有不同的部署目标。通过将所有故事板文件设置为使用“项目部署目标”来修复它。 在此处输入图片说明

回答by quemeful

Xcode 8

Xcode 8

Select the project file in the left pane. Then open the general tab and they have added a nice button that lets you select the file. (You may have to add it into your project structure as well)

在左窗格中选择项目文件。然后打开常规选项卡,他们添加了一个不错的按钮,可以让您选择文件。(您可能还必须将其添加到您的项目结构中)

enter image description here

在此处输入图片说明

回答by AceN

For me this happened as a result of enabling localization of the plist file (to give language specific identifier of the app on springboard).

对我来说,这是由于启用 plist 文件的本地化(以在跳板上提供应用程序的语言特定标识符)而发生的。

In targets>build settings>packaging>info.plist filekey i changed the path from AppName/AppName-info.plistto AppName/Base.lproj/AppName-info.plistand everything worked as expected.

目标>构建设置>打包>info.plist文件键中,我将路径从AppName/AppName-info.plist更改为AppName/Base.lproj/AppName-info.plist,一切都按预期工作。

Remember, its lproj as in a small L and not a capital I.

请记住,它的 lproj 是一个小 L 而不是大写的 I。

Hope this helps.

希望这可以帮助。

回答by joliejuly

I know it's been a while, but I faced the same issue, and the answers I've found weren't very clear for me, so I decided to make an instruction with a bunch of screenshots.

我知道已经有一段时间了,但我遇到了同样的问题,我找到的答案对我来说不是很清楚,所以我决定用一堆截图来做一个说明。

1) First, open the right-hand panel in xcode and click on your .plist file:

1) 首先,在 xcode 中打开右侧面板并单击您的 .plist 文件:

enter image description here

在此处输入图片说明

2) Second, choose Relative to projectlocation on the right-hand panel and copy the link just below it:

2) 其次,Relative to project在右侧面板上选择位置并复制其正下方的链接:

enter image description here

在此处输入图片说明

3) Third, go to the main project settings, choose your target and click on the Build settings tab:

3) 第三,转到主项目设置,选择您的目标并单击构建设置选项卡:

enter image description here

在此处输入图片说明

4) And finally, type Info.plistin the search field, double-click on the existing path and paste the link you have copied earlier:

4) 最后,Info.plist在搜索字段中输入,双击现有路径并粘贴您之前复制的链接:

enter image description here

在此处输入图片说明

In the end, clean the project Shift+ Cmd+ Kand re-run.

最后,清理项目Shift+ Cmd+ K,然后重新运行。

回答by Dirk Ackermann

under Xcode 4.6 if the appname-Info.plist is not visible under project -> target/info, go to summary tab and it will ask for the appname-Info.plist file. Select the correct file from the suggestion(s).

在 Xcode 4.6 下,如果 appname-Info.plist 在 project -> target/info 下不可见,请转到摘要选项卡,它会询问 appname-Info.plist 文件。从建议中选择正确的文件。

回答by PWiggin

Under Targets>Packaging>Info.plist file, make sure that the file path is correct.

在 Targets>Packaging>Info.plist 文件下,确保文件路径正确。

回答by jorisw

In my case, the file was there, but malformed. If you recently edited your Info.plist in a text editor, undo that change, and retry without breaking the markup validity.

就我而言,文件在那里,但格式不正确。如果您最近在文本编辑器中编辑了 Info.plist,请撤消该更改,然后在不破坏标记有效性的情况下重试。

回答by Adrian

For me the issue was that the error was referring to the Info.plistfrom a library I was using, not the actual .plistfile from the project.

对我来说,问题是错误是指Info.plist我正在使用的库中的.plist文件,而不是项目中的实际文件。

Maybe this will help someone in the future.

也许这会对将来的某人有所帮助。