问题
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.
回答1:
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...
回答2:
I got same issue even in xcode 9 beta 4. Solved by just checking this for Image.
Hope It helps.
回答3:
Fixed in Xcode 9 beta 3 (build 9M174d)
Jpeg assets in asset catalogs are found on iOS 10 or earlier for apps built with Xcode 9. (32524123)
回答4:
Make build with ios 11 device or generic ios device
来源:https://stackoverflow.com/questions/44652034/xcode-9-ios-10-issue-with-assets