ios 警告:复制捆绑资源构建阶段包含此目标的 Info.plist 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3095612/
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
Warning: The Copy Bundle Resources build phase contains this target's Info.plist file
提问by nevan king
I've separated a project into two builds and given each of them a plist
file. Everything works fine, but I keep getting this build warning:
我将一个项目分成了两个版本,并为每个版本提供了一个plist
文件。一切正常,但我不断收到此构建警告:
Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'MyApp-Info.plist'
警告:复制捆绑资源构建阶段包含此目标的 Info.plist 文件“MyApp-Info.plist”
I get this when I try to build MyApp
. Building for the second target gives the same error (with SecondTarget-Info.plist
in the warning). I'm not sure why it's a warning, since I wantthe build to contain that .plist
file. Each of the .plist
files have one target membership (for their own build).
当我尝试构建MyApp
. 为第二个目标构建给出了相同的错误(SecondTarget-Info.plist
在警告中)。我不确定为什么它是一个警告,因为我希望构建包含该.plist
文件。每个.plist
文件都有一个目标成员资格(用于它们自己的构建)。
What does this warning mean? Is there any way to make it go away?
这个警告是什么意思?有什么办法让它消失吗?
回答by JWWalker
https://developer.apple.com/library/content/qa/qa1649/_index.html
https://developer.apple.com/library/content/qa/qa1649/_index.html
Excerpt:
摘抄:
You are getting this warning because you probably added your Info.plist file to your Copy Bundle Resources build phase as shown in Figure
您收到此警告是因为您可能已将 Info.plist 文件添加到 Copy Bundle Resources 构建阶段,如图所示
The INFOPLIST_FILE build setting specifies the name of the Info.plist associated with your target. When building a target, Xcode reads this build setting and copies the referenced Info.plist into your application bundle. Because Xcode automatically processes the Info.plist, you should not add it to your Copy Bundle Resources build phase or make it a target member.
To resolve this warning, select your Info.plist from the Copy Bundle Resource build phase as shown in Figure 1, then click the Remove (–) button to delete it from the phase.
INFOPLIST_FILE 构建设置指定与目标关联的 Info.plist 的名称。构建目标时,Xcode 读取此构建设置并将引用的 Info.plist 复制到您的应用程序包中。由于 Xcode 会自动处理 Info.plist,因此您不应将其添加到复制捆绑资源构建阶段或使其成为目标成员。
要解决此警告,请从 Copy Bundle Resource 构建阶段中选择您的 Info.plist,如图 1 所示,然后单击 Remove (-) 按钮将其从该阶段中删除。
回答by Buchannon
To fix in xcode 4:
要在 xcode 4 中修复:
1) Remove the reference to your info.plist file by selecting it and hitting delete.
1)通过选择它并点击删除来删除对您的 info.plist 文件的引用。
2) Add the info.plist file again but choose no destination and uncheck the "add to targets" option.
2)再次添加Info.plist文件,但没有选择目的地,取消选中“添加到目标”选项。
回答by Marc
In case anyone runs into this with Xcode 3, to fix it click on the .plist file in the left column under "Groups and Files", and in the upper right area, uncheck the box next to the .plist file's name in the column under the bullseye icon. You'll need the editor zoomed out (View -> Zoom Editor Out) to show the checkboxes.
如果有人在使用 Xcode 3 时遇到此问题,请单击“组和文件”下左列中的 .plist 文件进行修复,然后在右上方区域中取消选中列中 .plist 文件名称旁边的框在靶心图标下。您需要缩小编辑器(查看 -> 缩小编辑器)以显示复选框。
回答by CrazyOne
Another solution is:
另一种解决方案是:
You might have accidentally removed a project file from the "target membership" core data.
您可能不小心从“目标成员资格”核心数据中删除了一个项目文件。
Select your Main.storyboard from the project navigator on the left
Go to the "file inspector" (first tab) on the right
Find the "Target Membership" list
Enable the check box
Give it a little time to process, but while your at it, also check the LaunchScreen.storyboard, .xcdatamodelid, Assets.xcassets, and all .swift files in your project. They should all have been enabled for target membership.
Note: the Info.plist should not have the target membership checked enabled.
从左侧的项目导航器中选择您的 Main.storyboard
转到右侧的“文件检查器”(第一个选项卡)
找到“目标会员”列表
启用复选框
给它一点时间来处理,但是在您处理它的同时,还要检查 LaunchScreen.storyboard、.xcdatamodelid、Assets.xcassets 和项目中的所有 .swift 文件。他们都应该为目标成员资格启用。
注意:Info.plist 不应启用目标成员资格检查。
Hope this helps.
希望这可以帮助。
回答by StuFF mc
Just as a note... I'm gonna try to write a nice Radar about it, but it's really weird the way Localization is handled in Storyboards in Xcode. If you ask "Show in Finder", you won't see your .storyboard file selected but instead its containing folder. I think it has to do with Localisation of the Storyboard. As soon as I changed that from English to German (and thus not having the file anymore in either root or en.lproj), I started to have trouble.
只是作为一个注释......我会尝试写一个关于它的不错的雷达,但在Xcode的故事板中处理本地化的方式真的很奇怪。如果您询问“在 Finder 中显示”,您将不会看到您的 .storyboard 文件被选中,而是它的包含文件夹。我认为这与情节提要的本地化有关。一旦我将其从英语更改为德语(因此在 root 或 en.lproj 中不再有该文件),我开始遇到麻烦。