xcode 应用程序图标未显示在 iPhone 模拟器中

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

app icon not showing in iphone simulator

iphonexcodeios-simulator

提问by Ben Collins

I have a 57x57 PNG file in the root of my bundle (update: and added to my project), and the "Icon file" setting in my .plist file has the correct filename, but when the app is installed to the simulator, the icon is the default grey/white one.

我的包的根目录中有一个 57x57 PNG 文件(更新:并添加到我的项目中),我的 .plist 文件中的“图标文件”设置具有正确的文件名,但是当应用程序安装到模拟器时,图标是默认的灰色/白色。

I've tried deleting my app from the simulator (both through the simulator and through rm -rf on the app directory from the console), I've tried cleaning my target, and I've tried renaming my app icon, all to no avail.

我试过从模拟器中删除我的应用程序(通过模拟器和控制台中应用程序目录上的 rm -rf ),我试过清理我的目标,我试过重命名我的应用程序图标,全部都没有有用。

What do I have to do to get the icon showing?

我该怎么做才能显示图标?

回答by Ben Collins

Got it! I added the file to my project, but it was added in association with the wrong target (a unit testing target). I got it associated with my app target and all was well.

知道了!我将该文件添加到我的项目中,但它是与错误的目标(单元测试目标)相关联的。我将它与我的应用程序目标相关联,一切都很好。

Update:

更新

To associate a file with a target, select the file and navigate context menu -> File Info -> Targets

要将文件与目标关联,请选择文件并导航上下文菜单 -> 文件信息 -> 目标

In the File Info dialog under the "Targets" tab, select the target membership desired.

在“目标”选项卡下的“文件信息”对话框中,选择所需的目标成员资格。

Done.

完毕。

回答by Adam Eberbach

One thing you didn't say is that you added it to the project. Once it is in your project, not just the directory, it should appear.

你没有说的一件事是你将它添加到项目中。一旦它出现在您的项目中,而不仅仅是目录中,它就会出现。

Another problem I have had is that some image editors are "helpful" about the file extension. This can lead to an image file named either "icon.png.png" or "icon" depending on which way they go. Check that too.

我遇到的另一个问题是某些图像编辑器对文件扩展名“有帮助”。这可能会导致一个名为“icon.png.png”或“icon”的图像文件,具体取决于它们的运行方式。也检查一下。

回答by Peter Zich

I also had a problem where one of my images was named "Icon-iPad.png" but was actually a PSD file, Preview and QuickLook ignored the extension and showed it normally. Double-check the format.

我也遇到了一个问题,其中一张图片被命名为“Icon-iPad.png”,但实际上是一个 PSD 文件,Preview 和 QuickLook 忽略了扩展名并正常显示。仔细检查格式。