xcode Default.png 显示在模拟器中但不在真实设备 iphone 上?

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

Default.png shows in simulator but not on real device iphone?

iphoneobjective-cxcodeios-simulator

提问by Rahul Vyas

i have added a splash screen to my application by adding Default.png. the splash screen works fine in the simulator but not showing on real device

我通过添加 Default.png 向我的应用程序添加了启动画面。启动画面在模拟器中运行良好,但在真实设备上不显示

回答by Corey Floyd

Check the case of the file name.

检查文件名的大小写。

Default.png, default.png, Default.PNG and DEFAULT.png are all different files on the device, but not in the simulator.

Default.png、default.png、Default.PNG 和 DEFAULT.png 在设备上都是不同的文件,但在模拟器中却没有。

回答by John Muchow

The file name must be Default.png (with a capital D). Also, do a clean/rebuild of the entire project to ensure the most recent version of the file is being included in the project.

文件名必须是 Default.png(大写 D)。此外,对整个项目进行清理/重建,以确保项目中包含最新版本的文件。

回答by zed

Make a "Default.png" file (with a capital "D"). Then clean all targets and build again.

制作一个“Default.png”文件(大写“D”)。然后清理所有目标并再次构建。

回答by tt.Kilew

Sometimes this issue hapens, when .png file was renamed from .jpg file. So, for example, you had image.jpg, you've renamed in to image.png, and using this image.png. It'll be correctly displayed in simulator, and won't work on device

当 .png 文件从 .jpg 文件重命名时,有时会出现此问题。因此,例如,您有 image.jpg,您已将其重命名为 image.png,并使用此 image.png。它将在模拟器中正确显示,并且在设备上不起作用

回答by Susanhe

Make sure the name of the file begins with a capital "D", then clean and rebuild.

确保文件名以大写“D”开头,然后清理并重建。

回答by Lounges

Select your Default.png in the groups and files window and make sure in the file listing above the editor window that the checkbox on the far right is checked. Without this the file will not be copied to the application bundle after compilation is finished.

在组和文件窗口中选择您的 Default.png,并确保在编辑器窗口上方的文件列表中选中了最右侧的复选框。如果没有这个,编译完成后文件将不会被复制到应用程序包中。