问题
I'm not using storyboards here, for reasons that would be a distraction to get into. I'm instead trying to add four launch images to an asset catalog:
My app doesn't support iPads or 3.5-inch iPhones, so these should be sufficient. Is that fine or do I need landscape as well?
Here are the properties of each of the images:
Here's the same information in textual form:
filename: LaunchImage.launchimage
children:
filename: 5.5.png
idiom: iphone
subtype: 736h
scale: 3x
orientation: portrait
extent: full-screen
minimum-system-version: 8.0
image:
height: 2208
width: 1242
filename: 4.7.png
idiom: iphone
subtype: 667h
scale: 2x
orientation: portrait
extent: full-screen
minimum-system-version: 8.0
image:
height: 1334
width: 750
filename: 3.5-inch, 2x-1.png
idiom: iphone
scale: 2x
orientation: portrait
extent: full-screen
minimum-system-version: 7.0
image:
height: 960
width: 640
filename: 4.png
idiom: iphone
subtype: retina4
scale: 2x
orientation: portrait
extent: full-screen
minimum-system-version: 7.0
image:
height: 1136
width: 640
Here's how my app is configured:
When I run the app on the iPhone 7 Plus, I see the 4.7-inch launch image. Why is this happening, and how do I fix it?
I tried using plain PNG files without putting them in an asset catalog, but that doesn't work, either, as discussed in this separate question.
Note that unlike other questions asking about this:
I'm not using xibs or storyboards, for reasons that would be a distraction to get into here.
I'm using PNG files wrapped in an asset catalog, as opposed to plain PNG files in the top-level directory.
I support only iOS 10 and above, which means I don't support 3.5-inch phones.
I don't support iPads.
I'm using Xcode 8.3 and running iOS 10.3 on my phone.
回答1:
I had an issue very similar to this recently, where my 4.7" iPhones were unable to load the 667h launch image and fell back to the size it could, being the 538h. Since iOS uses the presence of static launch images as one of its determinations for what resolution to display the app at, the app ended up coming out all blown up in resolution.
It doesn't sound like you're hitting that latter consequence, but I can share my fix: re-evaluate the color space you used to export those images and try exporting them again. I wasn't able to pin down the exact reason why the images were an issue for the platform, but re-exporting and cleaning helped. In addition to the color space, did you perhaps use a Save for Web option? I also found that affected things for us.
回答2:
Have you tried cleaning the project and the build folder, deleting derived data, removing the app from the device and restarting Xcode?
Might sound like a silly suggestion, but this has fixed so many things for me in the past.
来源:https://stackoverflow.com/questions/43168145/whats-wrong-with-my-asset-catalog-containing-launch-images