ios Xcode 5:“无效的图像路径”CFBundleIcons
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19316501/
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
Xcode 5: "Invalid image path" CFBundleIcons
提问by Jimmery
Ok, my problem seems to be similar to this, and this, but following the answers, there is not helping me. This might be because I am using Xcode 5, before I upgraded to this version I wasn't having any problems with this app.
好的,我的问题似乎与this和this类似,但是按照答案,没有帮助我。这可能是因为我使用的是 Xcode 5,在我升级到这个版本之前,我对这个应用程序没有任何问题。
When I validate my app I get the following error:
当我验证我的应用程序时,我收到以下错误:
"Invalid Image Path - No image found at the path referenced under key 'CFBundleIcons': 'icon152'"
“无效的图像路径 - 在键 'CFBundleIcons' 下引用的路径中找不到图像:'icon152'”
So I go to the .plist
file in Xcode, right click Show Raw Keys/Values
and find CFBundleIcons
.
所以我转到.plist
Xcode 中的文件,右键单击Show Raw Keys/Values
并找到CFBundleIcons
.
There is a tree that looks like this:
有一棵树看起来像这样:
▼ CFBundleIcons Dictionary
▼ CFBundlePrimaryIcon Dictionary
▼ CFBundleIconFiles Array
Item 0 String icon152
Now I've renamed icon152
to icon152.png
, and it still doesn't work. Does this value require the full path to the image on my mac? And if it does, why am I not getting the full path inserted when I add the image from scratch? I've validated apps before and never experienced these problems.
现在我重命名icon152
为icon152.png
,它仍然不起作用。这个值是否需要我的 mac 上图像的完整路径?如果是这样,当我从头开始添加图像时,为什么没有插入完整路径?我以前验证过应用程序,但从未遇到过这些问题。
I've tried removing all the icon entries out of the .plist
file and re-adding them, still doesn't work.
我已经尝试从.plist
文件中删除所有图标条目并重新添加它们,但仍然不起作用。
I've tried removing the images from the bundle and Xcode altogether, and completely re-added them from scratch. Still doesn't work.
我已经尝试从捆绑包和 Xcode 中完全删除图像,并从头开始完全重新添加它们。还是不行。
Can anybody tell me what I am doing wrong?
谁能告诉我我做错了什么?
EDIT:
编辑:
If anybody else is struggling with this, all I did to solve it was click the "Use Asset Catalog" button - and all these problems disappeared. You can find that button by clicking on your project in the Navigator, then under General scroll down to App Icons - the button should be there.
如果其他人为此而苦苦挣扎,我所做的就是单击“使用资产目录”按钮来解决它 - 所有这些问题都消失了。您可以通过在导航器中单击您的项目来找到该按钮,然后在常规下向下滚动到应用程序图标 - 该按钮应该在那里。
采纳答案by Enrico Susatyo
Can you try removing the icon from the project and adding them again? Then try to use the name without .png.
您可以尝试从项目中删除图标并重新添加它们吗?然后尝试使用没有 .png 的名称。
Sometimes Xcode can't see the changes if you modify the file in Finder.
如果您在 Finder 中修改文件,有时 Xcode 无法看到更改。
回答by Robert Bentley
I had the same error as ckoskar, "Invalid Image Path - No image found at the path referenced under key 'CFBundleIcons': 'icon120x120'"
我遇到了与 ckoskar 相同的错误,“无效的图像路径 - 在关键 'CFBundleIcons' 下引用的路径中找不到图像:'icon120x120'”
I ended up deleting the file from the CarPlay section in the AppIcon part of Images.xcassets, and then I was able to submit the build.
我最终从 Images.xcassets 的 AppIcon 部分的 CarPlay 部分删除了该文件,然后我能够提交构建。
回答by Samanthak
回答by J.P. Terry
Here is what worked for me:
这是对我有用的:
- Select the Target
- Go to Build Phases
- Expand the Copy Bundle Resources
- Go to the bottom of the panel and select the + sign.
- Add each of the missing resources.
- 选择目标
- 转到构建阶段
- 展开复制包资源
- 转到面板底部并选择 + 号。
- 添加每个缺失的资源。
回答by DamongoCoder
I too had the same issue, the interesting thing was that I was already using the asset catalog when this happened. The solution that ended up working for me is described here: Invalid Image Path - No image found at the path. CFBundleIcons Xcode 5
我也有同样的问题,有趣的是,发生这种情况时我已经在使用资产目录。最终为我工作的解决方案在这里描述: 无效的图像路径 - 在路径中找不到图像。CFBundleIcons Xcode 5
Basically you need to add the image to the target you are building. To do that, select the image in the list of files under your project in the Navigation Pane, then show the Utilities Paneon the right and check the target under Target Membershipin the Utilities Paneto the left
基本上,您需要将图像添加到您正在构建的目标中。要做到这一点,选择在文件列表中的图像中的项目下的导航窗格,然后显示在工具面板上的权利和检查目标下的目标会员的实用程序窗格向左
回答by Kaushik Chauhan
Sometimes that happens when you add files separately.
有时,当您单独添加文件时会发生这种情况。
Make sure you have the Build name's check box checked on the "Target Membership" area in the Utilitiespane.
确保在“实用工具”窗格中的“目标成员资格”区域中选中了“构建名称”复选框。
The files for which it is throwing an error would have that check box unchecked hence it does not get included in the final build.
它抛出错误的文件将取消选中该复选框,因此它不会包含在最终构建中。
By checking this checkbox I got my problem solved. Thank DomandoCoder!
通过选中此复选框,我解决了我的问题。感谢 DomandoCoder!
回答by oscarr
I had problem with:
我有以下问题:
"Invalid Image Path - No image found at the path referenced under key 'CFBundleIcons': 'icon120x120'"
“无效的图像路径 - 在键‘CFBundleIcons’下引用的路径中找不到图像:‘icon120x120’”
The solution was to move the icon (120x120) to a another appicon folder
解决方案是将图标 (120x120) 移动到另一个 appicon 文件夹
回答by uplearnedu.com
I had the same problem. I was trying to get a Free and Full version app to upload. The free app TARGET uploaded fine though I had problems with the Paid TARGET. I selected all the images used for icons in the PAID and FREE versions and then looked at : FILE INSPECTOR --> TAGET MEMBERSHIP -> make sure to check them both and then it'll be OK. Worked for me.
Here's the error I had:
我有同样的问题。我试图获得一个免费和完整版本的应用程序来上传。免费应用程序 TARGET 上传得很好,但我在使用付费 TARGET 时遇到了问题。我选择了付费和免费版本中用于图标的所有图像,然后查看:文件检查器 --> 目标会员-> 确保同时检查它们,然后就可以了。为我工作。这是我遇到的错误:
Then I selected and checked these for PAID and FREE versions of the app:
然后我选择并检查了这些应用程序的付费和免费版本:
I hope this helped. Check out roulette tracker and my other apps! Please vote if this helped you.
我希望这有帮助。查看轮盘跟踪器和我的其他应用程序!如果这对您有帮助,请投票。
回答by yeahdixon
Well for me it was not any of these. I kept adding and cleaning to no avail
对我来说,这些都不是。我一直添加和清理无济于事
there was list of icons in the plist under:
plist 中的图标列表如下:
CFBundleIconFiles~ipad and CFBundleIconFiles
CFBundleIconFiles~ipad 和 CFBundleIconFiles
There were a few in there that did not exist. I removed/ updated and that seemed to work.
那里有一些不存在的。我删除/更新,这似乎工作。
回答by user3551709
Make sure the image is added to the project:
确保将图像添加到项目中:
- expand the Resources folder
- if the file is there remove it
- if the file is not there add it by right clicking the Resources folder
- clean the build and rebuild
- 展开资源文件夹
- 如果文件在那里删除它
- 如果文件不存在,请通过右键单击资源文件夹添加它
- 清理构建和重建