ios Info.plist 实用程序错误:“Info.plist 无法打开,因为没有这样的文件”

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

Info.plist Utility Error: "Info.plist couldn't be opened because there is no such file"

iosobjective-cxcoderelative-pathinfo.plist

提问by narner

I'm running into what seems to be common error, in that Xcode can't seem to find my 'Info.plist' file.

我遇到了似乎是常见的错误,因为 Xcode 似乎找不到我的“Info.plist”文件。

I've checked the answers to these two StackOverflow questions (Could not read from Info.plistand Objective C/Xcode error: The file “Info.plist” couldn't be opened because there is no such file)...I am using a relative path, and the plist file is in the correct absolute location. The type and location are correct as shown in the image below:

我已经检查了这两个 StackOverflow 问题的答案(无法从 Info.plistObjective C/Xcode 错误中读取:无法打开文件“Info.plist”,因为没有这样的文件)......我是使用相对路径,并且 plist 文件位于正确的绝对位置。类型和位置正确,如下图所示:

plist path

路径

My biggest concern is that this is now happening on multiple projects, including one I ran successfully just a few hours ago! Does anyone know how to solve this???

我最担心的是,这种情况现在发生在多个项目中,包括我几个小时前成功运行的一个!有谁知道如何解决这个问题???

EDITI've also tried reinstalling XCODE and replacing the plist file. Xcode still can't find 'info.plist'.

编辑我也试过重新安装 XCODE 并替换 plist 文件。Xcode 仍然找不到“info.plist”。

NOTEI wanted to add that this was for Xcode 6.2.X (I can't remember which version number exactly, but it was pre-Xcode 6.3.X).

注意我想补充一点,这是针对 Xcode 6.2.X(我不记得确切的版本号,但它是 Xcode 6.3.X 之前的版本)。

采纳答案by narner

The solution for this particular instance of the error was “Info.plist couldn't be opened because there is no such file” was that I had deleted all of the files in the "Project Tests" folder, but was still had "Project Tests" listed under my targets. After deleting the "tests" target, the project built successfully.

这个特定错误实例的解决方案是“Info.plist 无法打开,因为没有这样的文件”是我已经删除了“项目测试”文件夹中的所有文件,但仍然有“项目测试” “列在我的目标下。删除“tests”目标后,项目构建成功。

回答by nivritgupta

I also face the similar issue in xcode 7.0 but none of the above Solutions Worked for me, at last I get a chance to solved this issue

我在 xcode 7.0 中也遇到了类似的问题,但以上解决方案都不适合我,最后我有机会解决这个问题

  1. Go to: App Target
  2. See the Identify and choose the Plist
  1. 前往:应用目标
  2. 查看识别并选择 Plist

See the screenshot also

另请参阅屏幕截图

enter image description here

在此处输入图片说明

Enjoy

享受

回答by neha_sinha19

I faced similar kind of situation when I updated my XCode to 6.1. My project contained Info.plist but I got this error: "The file “Info.plist” couldn't be opened because there is no such file." Therefore, I looked up to the targets of my application which were: "App" & "AppTests". I checked for the 'Packaging' field in 'Build Settings' tab.

当我将 XCode 更新到 6.1 时,我遇到了类似的情况。我的项目包含 Info.plist,但出现此错误:“无法打开文件“Info.plist”,因为没有此类文件。因此,我查看了我的应用程序的目标:“App”和“AppTests”。我检查了“构建设置”选项卡中的“包装”字段。

Target: 'App' -> 'Build Settings' -> 'Packaging' -> 'Info.plist file(field)' - the location should be correct

目标:'App' -> 'Build Settings' -> 'Packaging' -> 'Info.plist file(field)' - 位置应该是正确的

Target: 'AppTests' -> 'Build Settings' -> 'Packaging' -> 'Info.plist file(field)' - the location must be something like this: 'AppTests/Info.plist'.Keep this field empty.Delete the location.

目标:'AppTests' -> 'Build Settings' -> 'Packaging' -> 'Info.plist file(field)' - 位置必须是这样的:'AppTests/Info.plist'。保持这个字段为空。删除那个地点。

It seems that Apple is checking this location by default for finding Info.plist. Clean & Build your project. It will work. Worked for me.

似乎 Apple 正在默认检查此位置以查找 Info.plist。清理并构建您的项目。它会起作用。为我工作。

回答by joliejuly

XCode 10 and 11

XCode 10 和 11

I know it's been a while, but I faced the same issue today, and the answers I've found weren't very clear for me, so I decided to make an instruction with 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 Budyn

For me, the anwser for this issue was:

对我来说,这个问题的答案是:

1.Turn off Xcode

1.关闭Xcode

2.Go to ./Users/You/Library/Developer/Xcode/DerivedData

2.转到./Users/You/Library/Developer/Xcode/DerivedData

3.Delete everything from this folder

3.删除此文件夹中的所有内容

4.Run Xcode

4.运行Xcode

5.Build&Clean

5.构建和清洁

Xcode version: 6.4 (6E35b)

Xcode 版本:6.4 (6E35b)

回答by Preetha

In my case i was edited my xcode project folder name so that this is happened after changing folder's new name(Project -> Targets -> Build settings -> Packaging -> Info.plist name) then working fine.

在我的情况下,我编辑了我的 xcode 项目文件夹名称,因此这是在更改文件夹的新名称(项目 -> 目标 -> 构建设置 -> 打包 -> Info.plist 名称)然后正常工作后发生的。

回答by amit gupta

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

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

回答by iDevAmit

As answered by @narner (answer marked as correct), yes it can make code work. But here is something better to solve the problem.

正如@narner 所回答的(答案标记为正确),是的,它可以使代码工作。但这里有更好的方法来解决这个问题。

My suggestion is that instead of delete tests targets, better if we change the path of info.plist under tests target.

我的建议是,与其删除测试目标,不如更改测试目标下的 info.plist 路径。

Simple steps:-

简单步骤:-

In project, click on the project file -> ProjectNameTests(under targets) ->Build settings->Packaging->Info.plist Here you change the path of file.

在项目中,点击项目文件-> ProjectNameTests(在targets下)->Build settings->Packaging->Info.plist 这里你改变文件的路径。

回答by Konstantine Nikka-Sher Piterma

Relocate the files by double clicking on this icon:

通过双击此图标重新定位文件:

enter image description here

在此处输入图片说明

I had this issue too for the past couple hours. I had downloaded my github project from an earlier version. the search paths seem to have gotten confused and needed to be explicitly told where the files were located.

过去几个小时我也遇到了这个问题。我从早期版本下载了我的 github 项目。搜索路径似乎变得混乱,需要明确告知文件所在的位置。

回答by Vladimír Slavík

Also you can check the target dependencies. It took me 1hr before realising that I have copied a UI test target for target A, but there was a dependency left. So the build required a file that was not mapped to target B, but only to A.

您也可以检查目标依赖项。我花了 1 小时才意识到我已经为目标 A 复制了一个 UI 测试目标,但仍然存在依赖关系。因此构建需要一个未映射到目标 B 而仅映射到 A 的文件。

ui test for target B: dependency for target B and A

目标 B 的 ui 测试:目标 B和 A 的依赖关系