xcode 为什么应用程序图标是白色的?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5068296/
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
Why is app icon white?
提问by 4thSpace
Some recent version of iOS caused my app icon to turn white. I've gone through everything in regards to images and can't find the issue. I'm running Xcode 3.2.5 with sdk 4.2. I do have an entry for "Icon files" in Info.plist with 5 keys: Item 0 myapp.png Item 1 [email protected] Item 2 myapp-72.png Item 3 myapp-Small-50.png Item 4 myapp-Small.png Item 5 [email protected]
某些最新版本的 iOS 导致我的应用程序图标变白。我已经完成了有关图像的所有内容,但找不到问题。我正在使用 sdk 4.2 运行 Xcode 3.2.5。我在 Info.plist 中有一个“图标文件”条目,有 5 个键: Item 0 myapp.png Item 1 [email protected] Item 2 myapp-72.png Item 3 myapp-Small-50.png Item 4 myapp- Small.png 项目 5 [email protected]
All the above have proper dimensions.
以上都有适当的尺寸。
I see the image in 'Copy Bundle Resources' and also in the .app file for the simulator version. It is properly reference by name in 'Icon files', Item 0. It is not named Default.png since it is referenced by name in Item 0.
我在“复制捆绑资源”和模拟器版本的 .app 文件中看到了图像。它在“图标文件”中按名称正确引用,项目 0。它未命名为 Default.png,因为它在项目 0 中按名称引用。
Any suggestions?
有什么建议?
回答by Fabio Poloni
You just need those 3 Files:
你只需要这 3 个文件:
Icon.png [email protected] Icon-iPad.png
Icon.png [email protected] Icon-iPad.png
Put the names into the Info.plist under Icon Files.
将名称放入 Icon Files 下的 Info.plist 中。
EDIT: Clean your target if it still won't work!
编辑:如果它仍然不起作用,请清洁您的目标!
回答by Den Mikhailov
That is what helped me (project summary - app icons are ok, iOS simulator - app icons are ok, iPhone device - blank icon). Just reconnect your icons to project by dragging them from project navigator to App icon section in project summary.
这就是帮助我的原因(项目摘要 - 应用程序图标正常,iOS 模拟器 - 应用程序图标正常,iPhone 设备 - 空白图标)。只需将您的图标从项目导航器拖到项目摘要中的应用程序图标部分,即可将它们重新连接到项目。
回答by Christopher
The icon file name may be too long if it is a custom file name. This is just a guess, and I hate guessing, but this appears to have been the problem I just had.
如果是自定义文件名,图标文件名可能会太长。这只是一个猜测,我讨厌猜测,但这似乎是我刚刚遇到的问题。
I have four targets using the same code but with different icons. I named the icons differently based on the app name, so I could store them in the same directory.
我有四个使用相同代码但图标不同的目标。我根据应用程序名称对图标进行了不同的命名,因此我可以将它们存储在同一目录中。
For example:
例如:
Icon.png
Icon_second.png
Icon_alternate.png
Icon_second_alternate.png (or Icon_secondalternate.png in case underscores were an issue)
Icon.png
Icon_second.png
Icon_alternate.png
Icon_second_alternate.png (或 Icon_secondalternate.png 以防下划线有问题)
This nomenclature was used for all of the icon names (there's 8 icon files to support iPhone, iPad, retina, etc).
此命名法用于所有图标名称(有 8 个图标文件支持 iPhone、iPad、Retina 等)。
The last one was giving me a problem. Despite a hundred clean/rebuilds, deleting the schema entirely and creating a new one, fruitless efforts, it suddenly occurred to me to try renaming it.
最后一个给我带来了问题。尽管进行了一百次清理/重建,完全删除了模式并创建了一个新的模式,但徒劳无功,我突然想到尝试重命名它。
You should be able to name the icons differently, as I still use the first three versions. They are listed in the plist file and render in the project summary, and on the simulator, just fine. The last one rendered in the summary as well. However, I think the length of the file name was too long for the simulator. There must be a length limit. I renamed the fourth one to use the standard Icon.png naming but added it to the fourth target only (images are stored in a separate folder).
您应该能够以不同的方式命名图标,因为我仍然使用前三个版本。它们列在 plist 文件中,并在项目摘要中渲染,在模拟器上,就好了。最后一个也在摘要中呈现。但是,我认为文件名的长度对于模拟器来说太长了。必须有长度限制。我将第四个重命名为使用标准 Icon.png 命名,但仅将其添加到第四个目标(图像存储在单独的文件夹中)。
CONCLUSION: If you have more than one target for your app, use the standard naming system for all of your icons but add them to separate folders, and then when adding to Xcode just set the build target appropriately.
结论:如果您的应用程序有多个目标,请为所有图标使用标准命名系统,但将它们添加到单独的文件夹中,然后在添加到 Xcode 时只需适当设置构建目标。
回答by Stephen Darlington
Whendoes it turn white? If you upgrade an app when it's running, sometimes it appears with a white icon in the "task" bar. This applies to apps you're developing and those download from iTunes. The fix is usually just to kill the app and restart.
什么时候变白?如果您在应用程序运行时对其进行升级,有时它会在“任务”栏中显示一个白色图标。这适用于您正在开发的应用程序以及从 iTunes 下载的应用程序。修复通常只是杀死应用程序并重新启动。
That's the simplest answer, but I suspect might not be the solution.
这是最简单的答案,但我怀疑可能不是解决方案。
Does the case of the file names in your Info.plist
match the actual file names? The Simulator is not case sensitive but the iOS is.
文件名的大小写Info.plist
与实际文件名匹配吗?模拟器不区分大小写,但 iOS 是。
You might also like to make a completely clean build. Don't just do a "Clean" in Xcode, instead manually clear out your build folder.
您可能还想制作一个完全干净的构建。不要只是在 Xcode 中进行“清理”,而是手动清除您的构建文件夹。
Finally, when the iPhone 4 first came out I had some issues with the order of the icons referenced in the Info.plist
. I never saw white icons (usually just the non-Retina version) but this may be something worth playing with if nothing else works.
最后,当 iPhone 4 首次问世时,我对Info.plist
. 我从未见过白色图标(通常只是非 Retina 版本),但如果没有其他效果,这可能值得一试。
回答by hotpaw2
Load the icons into the Preview application, and make sure they are really png format (and not just named such) by doing a "Save As..." specifying PNG format in the save dialog. Do a Get Info to check the sizes. Make sure the case of all letters in the name match your plist entries.
将图标加载到预览应用程序中,并通过在保存对话框中执行“另存为...”指定 PNG 格式来确保它们确实是 png 格式(而不只是命名为此类)。做一个获取信息来检查尺寸。确保名称中所有字母的大小写与您的 plist 条目匹配。
回答by Seidr
I had the same problem recently - the Icons I was using were created in GIMP. When I opened them in Photoshop on the development Mac it complained about an ICC color profile. After re-saving the PNGs in Photoshop the Icons worked like a treat.
我最近遇到了同样的问题 - 我使用的图标是在 GIMP 中创建的。当我在开发 Mac 上的 Photoshop 中打开它们时,它抱怨 ICC 颜色配置文件。在 Photoshop 中重新保存 PNG 后,图标就像一种享受。
P.s. I just repeated my steps in creating the images in GIMP, but when saving unticked every extra option that GIMP - by default - was trying to add into the image when saving it. The icons worked perfectly this time around.
Ps 我只是重复了我在 GIMP 中创建图像的步骤,但是在保存时取消勾选 GIMP - 默认情况下 - 在保存图像时尝试添加到图像中的每个额外选项。这次的图标工作得很好。
回答by Basil Bourque
If you believe your icon configuration is correct, then you may simply be seeing a bug in Xcode.
如果您认为您的图标配置是正确的,那么您可能只是在 Xcode 中看到了一个错误。
As a workaround…
作为一种解决方法…
- "Clean" your project. Choose
Xcode > Product > Clean
. - Delete the app from your simulator, or even reset the Simulator by choosing
iOS Simulator > Reset Content and Settings
. - Quit both the
iOS Simulator
andXCode
apps, then restart them.
- “清理”你的项目。选择
Xcode > Product > Clean
。 - 从模拟器中删除应用程序,甚至通过选择 重置模拟器
iOS Simulator > Reset Content and Settings
。 - 退出
iOS Simulator
和XCode
应用程序,然后重新启动它们。
回答by WrightsCS
If you still have the default icon entry (even blank), this can happen, remove that entry in info.plist.
如果您仍然拥有默认图标条目(甚至是空白),则可能会发生这种情况,请在 info.plist 中删除该条目。
Also, Default.png would be your splash screen.
此外, Default.png 将是您的启动画面。