Xcode 9编译iOS 8应用图片失真 求临时解决方案
Update: Fixed in Xcode 9.3!
Awesome news—this frustrating image distortion bug has been fully fixed in Xcode 9.3, so upgrading your Xcode version is the best permanent fix here.
What I Ran Into
When I upgraded to Xcode 9 (specifically version 9.2, build 9C40b, which was the latest at the time), I hit a weird issue: every image in my app got distorted, but only on iOS 8 devices. The kicker? Compiling the exact same project with Xcode 8 worked flawlessly across all iOS versions, including iOS 8.
I first spotted this with the app's launch screen—here's how it played out:
- On iOS 8 (built with Xcode 9): Launch screen images looked stretched/distorted
- On iOS 9, 10, or 11 (built with Xcode 9): Launch screen showed up perfectly normal
This felt deja vu—there was a similar bug in Xcode 8 Beta 6 that got fixed in the Xcode 8 GM release. But when I searched around, I couldn't find any existing reports for this Xcode 9-specific problem.
Things I Tried (That Didn't Fix It)
Since Xcode 9 made a lot of changes to how image assets are handled, I tested a bunch of common tweaks with no luck:
- Turning on the
Preserve Vector Dataoption for my image assets - Switching the asset scaling setting to
Individual scales
Potential Temporary Workarounds
If you can't upgrade to Xcode 9.3 right now (maybe you're locked into a specific build for a pending release), here are a few ideas to try:
- Temporarily downgrade to Xcode 8: If your project doesn't depend on Xcode 9-only features, compiling with Xcode 8 will get your images rendering correctly on iOS 8 again.
- Rasterize vector assets: If you're using vector images, export them as PNGs at each required scale (@1x, @2x, @3x) and swap out the vector assets—this might bypass the scaling bug causing distortion.
- Reset asset catalog settings: Sometimes hidden conflicts in your asset catalog can cause issues. Try resetting the catalog to default settings, then reconfiguring your assets from scratch.
If you've found another workaround that worked for your project, drop it in the comments—I'm sure others would appreciate it!
内容的提问来源于stack exchange,提问作者AnthoPak

