1

As soon as I updated my iPhone XS Max to 13.2.2 & macOS Catalina to 10.15.1 I returned working on my project & ran it onto my device. Immediately I noticed every UIImageView that was displaying a UIImage created from an SKTexture.cgImage() was rendering something that literally looked like the missingno from Pokemon Red. Those same atlas textures render fine inside SKSpriteNode's. Log debugging returns the UIImage memory as uiimage anonymous

enter image description here

The horizontal white & blue lines is a single background image that has nothing to do with anything. There's a second, smaller image view on top & it's the one rendering the missingno/corrupt image with the texture cgImage() call. My code is by the book standard for this:

let image = UIImage(cgImage: SKTextureAtlas(named: char.atlasName).textureNamed(char.imageNames.first!).cgImage()
self.imageView.image = image
self.imageView.layer.magnificationFilter = .nearest

My only guess is the latest update did this. I literally did nothing else after updating my system. Just opened the project & ran it. Any ideas if this can be fixed? Yes, the standard derived data deletion has been tried. Xcode -> Product -> Clean Build Folder as well Mac & iPhone have been restarted I don't know what else I can do but pray

Krekin
  • 1,516
  • 1
  • 13
  • 24
  • 1
    Pretty sure it's a bug on Apple's end. I also got bitten by it. It seems likely it's related to the physics-body-from-texture stuff that was happening in the early 13.x releases. That got fixed (though not for textures in atlases), but the "fix" seemed to break the cgImage conversion. There's some mixed in discussion about cgImage issues in these threads that might give you some ideas: https://forums.developer.apple.com/thread/123998 https://forums.developer.apple.com/thread/115152 – bg2b Nov 15 '19 at 18:18
  • Sweet! Was beginning to worry I was alone – Krekin Nov 15 '19 at 18:21
  • 1
    FWIW, we worked around these issues by adding not-in-atlas-copies of certain textures, though we only need SKPhysicsBody(texture:size:) to work and I didn't check cgImage. Another thought that just occurred might be to try making an SKSpriteNode with the offending texture and then getting a new texture by calling SKView's texture(from:) method. Presumably that texture won't be part of an atlas and maybe cgImage will work on it. Of course it may be that the texture(from:) suffers from the same underlying bug; I haven't tried this approach. – bg2b Nov 15 '19 at 18:31
  • 1
    I'm also seeing corrupted textures in iOS 13.4. It's at the image level; QuickLooking the cgImage reference in Xcode shows that it's corrupted. As far as I can tell, the only solution is to provide copies of the assets as regular images that UIImage can load. Very annoying and wasteful. – Womble Jul 20 '20 at 06:23

0 Answers0