Spritekit/Universal images from assets not showing up on iOS 9?

Deadly 提交于 2019-12-12 19:18:56

问题


I made a universal app using SpriteKit and Swift. Users have sent out bug reports on iOS 9 where sprite node images are showing up white/blank. But I haven't been able to reproduce this in the simulator. The images that don't show up are all device-specific in images.xcassets.

The images that do show up are the ones that are universal in images.xcassets.

What could I do to solve this (besides making them not device-specific) and could this possibly be an XCode/iOS bug?


回答1:


Yeah it's a bug for iOS 9.

What has worked so far is rebuilding everything and adding the format extension of the image whenever you call it. So for example, if your image is .png, then when you say something like:

SKSpriteNode *sprite = [SKSpriteNode spriteNodeWithImageNamed:@"myImage.png"];

Try this instead of using the string "myImage", which would normally work for previous OS's.




回答2:


Please make sure that image adding into the images.xcassets is into png. if you used Jpg / jpeg then some time its not working into Xcode 7 / iOS 9.0



来源:https://stackoverflow.com/questions/32746081/spritekit-universal-images-from-assets-not-showing-up-on-ios-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!