我有一个支持iOS8及以后版本的应用程序,内置在Xcode 7中,我使用XIB作为启动屏幕(我没有启动图像)。视图包含一个带有应用版本的UILabel,以及两个带有图像的UIImageViews,这两个图像都出现在images中。xcassets:标志和启动图像。

当我启动应用程序时,UILabel和logo图像显示正确,但如果我在带有iOS9的iPad Air 2上运行应用程序,启动图像就不能显示。我在运行iOS8的Air和Mini上进行了测试,在iPad 2、iPad Air和iPad Air 2的iOS9模拟器上进行了测试,图像在所有这些模拟器上都显示正确。

我运行了一些基本的故障排除,看看我是否能找出发生了什么,但我还没能解决它,我能看到的图像之间的唯一区别是,工作和一个失败的是,当我添加到资产…

以下是我所知道的:

The UIImageView for the splash image is in the correct place, at the correct size. I can tell this because I set its background color to green just to make sure. The view is there, but the image does not appear. So I'm assuming that the view is not to blame. Setting the UIImageView for the splash image to also use the logo image makes the logo image appear in the correct place for the view. This also leads me to assume that the view is not to blame. The UIImage that I am using in the splash image view is used elsewhere in the app and appears fine in those other views (the logo image is also used elsewhere in the app and appears fine). So I'm assuming that the image is valid and having it appear in other views is not a problem. I've confirmed that the settings of the UIImages for the logo and splash in the xcassets file are the same. They are set to Universal, Any width and height, multiple scale factors, rendered as default. There is one difference - the logo has 1x, 2x and 3x scales while the splash image only has 1x and 2x, but I have also tried using UIImages with only 1x, and 1x and 2x values in the UIView and they work (if they were added to the project some time ago). Adding another image of a different size or format (PNG and JPG) to my xcassets and using that UIImage in the UIImageView for the splash image also fails to display. Adding another UIImageView to the XIB file and allocating it a UIImage that was already in the xcassets works, the image appears in the loading screen. Copying and renaming the image files used for the logo and adding them to the project then using that UIImage in the splash view also fails to display. I have tried cleaning the project, restarting the development machine, and deleting the app from the Air 2 and reinstalling it just in case that was a problem.

这最后三个步骤使我相信,在项目文件生命周期的某一点之后添加的图像存在一些问题。当我昨天更新到Xcode 7时,splash图像最初是在Xcode 6中添加的,但logo图像(也添加到Xcode 6中)是在几个月前添加的。

我已经查看了logo图像和splash图像的json文件,它们似乎具有相同的格式。我还浏览了pbxproj文件,寻找不同之处,但我找不到任何不同之处。

所以我想知道是否有人知道为什么我在Air 2上添加的这些新图像在启动屏幕上不显示?我一直在阅读的其他有关未出现图像的问题似乎都与Launch images有关,或与XIB文件中具有关联类的图像有关,这两个问题在这里似乎都不相关。


当前回答

我也看到了同样的问题。重新启动设备(iPhone 6)并重新构建应用程序到设备是唯一修复它的方法。我尝试了许多其他的技巧和建议,但都不起作用。只有重启+重建才有帮助。

其他回答

对我来说,问题是我的启动屏幕的大小相差了1个像素(2209x1242而不是2208x1242)。纠正错误,然后重新启动设备并重新构建应用程序会有所帮助。

我在iPhone 6上也遇到了同样的问题。

非常奇怪的事实是,我可以使用我的图像中的另一个图像。Xcassets有相同的大小,压缩,颜色空间…

我不知道为什么它不起作用,但我找到了一个解决方案: 只需将文件放在图像之外即可。xcassets并在Interface Builder中使用它的全名(带扩展名)

希望这对你有所帮助!

对我有帮助的是:

将“启动屏幕文件”更改为另一个xib 运行应用程序 把xib改回来

同样重要的是:检查你的is xib是否在另一个标签中打开,这也可能导致它!

在我的情况下,我只是去应用程序目标->通用->应用程序图标和启动图像->启动图像源 然后选择源我把图像 希望这对你有所帮助

我在iPad和iPhone设备的Xcode 7中也遇到了同样的问题。尽管这没有任何意义,但我在大多数情况下都能够绕过它,方法是将图像视图中的Image以及高亮图像设置为images.xcassets中的同一图像。