Xcode 9,iOS 10资产问题 [英] Xcode 9, iOS 10 issue with Assets
问题描述
我在使用iOS 10的设备上运行资产和Xcode 9 beta时遇到问题,它没有上传资产中的任何图像,因此在手机上我看不到任何资产!
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:
***-[_ CUIThemePixelRendition _initWithCSIHeader:],/BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreUI/CoreUI-428.6/CoreTheme/ThemeStorage/CUIThemeRendition.m:3788中的断言失败 无法加载从标识符为"myIdentifierName"的捆绑包中的笔尖引用的"imageName"图像
*** 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"
这很奇怪,因为在具有iOS 11 beta的另一台设备上运行的相同代码可以正常工作,而且我可以看到图像.
This is strange as the same code running on another device with iOS 11 beta works and I can see the images.
推荐答案
在iOS 10上测试应用程序时遇到了同样的问题. 查看Xcode 9 Beta发行说明,发现有关的已知问题:
I got same problem when I test app on iOS 10. Check the Xcode 9 beta release note and found known issues about that:
资产目录
-
对于使用Xcode 9构建的应用程序,在iOS 10或更早版本上找不到资产目录中的Jpeg资产.用于访问图像的API调用,例如UIImage.imageNamed:返回nil. (32524123)
解决方法:使用png资源或将应用测试限制为运行iOS 11或更高版本的设备.
- 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.
将我所有的jpg素材资源转换为png后.很好哦...
After convert all my jpg asset to png. It's works well. Oh...
这篇关于Xcode 9,iOS 10资产问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!