Xcode 9, iOS 10 issue with Assets

ⅰ亾dé卋堺 提交于 2020-01-03 13:05:53

问题


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

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