Search code examples
ios10assetsios11xcode9-betaxcode9

Xcode 9, iOS 10 issue with Assets


I'm having a problem with assets and Xcode 9 beta running on devices with iOS 10. It doesn't upload any image from assets, so on the phone I can't see any asset!

If I load images in the storyboard, it just doesn't show any image on the phone (but it shows in the storyboard), if I do something:

UIImage(named:"imageName")!

It crashes with log message:

*** Assertion failure in -[_CUIThemePixelRendition _initWithCSIHeader:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreUI/CoreUI-428.6/CoreTheme/ThemeStorage/CUIThemeRendition.m:3788 Could not load the "imageName" image referenced from a nib in the bundle with identifier "myIdentifierName"

This is strange as the same code running on another device with iOS 11 beta works and I can see the images.


Solution

  • I got same problem when I test app on iOS 10. Check the Xcode 9 beta release note and found known issues about that:

    Asset Catalog

    • Jpeg assets in asset catalogs are not found on iOS 10 or earlier for apps built with Xcode 9. API calls for accessing the image such as UIImage.imageNamed: return nil. (32524123) Workaround: Use png resources or limit app testing to devices running iOS 11 or later.

    After convert all my jpg asset to png. It's works well. Oh...