Impossible to load an image in xcassets on bundle


|
I need to include images in a static library. I created a bundle and inserted in my images, the problem is that it seems to work if I include the images directly in the bundle, but stops working if I put in a xcassets file. I followed many guides and searched for a solution on this site. The most popular solution is to insert this line of code:
but it seems not work for me any ideas? |
|||||||||||||||||||||||||
|
|
There are two ways to solve this, If your app is still supporting iOs 7, you can use this category:https://gist.github.com/serluca/e4f6a47ffbc19fccc63e Otherwise, starting from iOs 8 Apple added a way to do this using: |
|||||||||||||||||||||||||
|


|
Running the same problem. Looks like inline bundle support is broken for XCAssets in the 1-parameter imageNamed method. There's a workaround though using imageNamed:inBundle:compatibleWithTraitCollection: Be careful, this is iOS8 only !!
NOTE : traitCollection is set to nil to pass the main screen traits as per apple docs (i don't quite get what it means though, if anyone knows please comment!). |
|||||||||||||
|
|
Our images are placed in Images.xcassets and we had a problem with loading images in an IBDesignable. The following code did the job for the preview in Interface builder and the app as well:
|
|||||||
|
Impossible to load an image in xcassets on bundle的更多相关文章
- 解决React Native unable to load script from assets index.android.bundle on windows
React Native运行的时候,经常碰到React Native unable to load script from assets index.android.bundle on windows ...
- React Native: unable to load scripts from assets 'index.android.bundle' on real device
问题:重新建了一个项目后,运行react-native run-android报: unable to load scripts from assets 'index.android.bundle' ...
- 项目初始化以后出现:Unable to load script from assets 'index.android.bundle
Mac中真机测试React Native project时出现Unable to load script from assets 'index.android.bundle' 2018年01月21日 ...
- react native中Unable to load script from assets 'index.android.bundle'解决方案
刚刚朋友问我,说是创建好一个项目,运行后报错:Unable to load script from assets 'index.android.bundle',以前好好的没出现这种现象,于是我找到一个 ...
- unable to load script from assets 'index.android bundle'
在Android手机上运行React-native项目时 报错:unable to load script from assets 'index.android bundle' ,make sure ...
- Unable to load script from assets 'index.android.bundle'.make sure you bundle is packaged correctly
解决此问题 以下方法每次都需要执行命令2才能更新 1.创建assets目录 mkdir android/app/src/main/assets 2.执行命令 react-native bundle - ...
- Unable to load script from assets 'index.android.bundle' 出错?
野路子太多,坑人真的!F**k 言归正传,当你运行 react native 程序的时候出现这个错误 ,如果您使用Windows,请按以下方式运行命令,或者如果出现错误“无法找到条目文件index.a ...
- Unable to load script from assets 'index.android.bundle'.Make sure your bundle is packaged correctly or you're running a packager server
curl -k 'http://localhost:8081/index.android.bundle?platform=android' > android/app/src/main/asse ...
- MemoryModule -- load a DLL completely from memory
https://github.com/fancycode/MemoryModule MemoryModule is a library that can be used to load a DLL c ...
随机推荐
- Java Js实现导出csv
$.ajax({ type: 'GET', async: false, url: '../../api/screening/exportTable?seriesIndex=' + param.seri ...
- uva 10817(状压dp)
题意:就是有个学校要招老师.要让没门课至少有两个老师可以上.每个样样例先输入三个数字课程数量s,已经在任的老师数量,和应聘的老师数量.已经在任的一定要聘请. 思路是参考了刘汝佳书上的,关键如何状压. ...
- MYSQL5.7版本sql_mode=only_full_group_by问题
具体出错提示: [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggr ...
- sql行列旋转
一,行转列 先建立测试数据 if OBJECT_ID('week_income') is not null drop table week_income go create table week_in ...
- java向Excel文件写入数据
/*使用之前要记得导入第三的jar包这个是我之前使用的时候那别人的东西自己修改了一下 还没来得及好好地封装一下还望见谅,注释我感觉写的挺清楚的就在不进行解释代码了*/package com.zzp.E ...
- umask
1. 首先我们来思考umask是什么? umask 是系统设置的权限的默认值,在etc/profile里面的shell 脚本有设置规则. 对于root用户和用户而言,不可以直接用的 需要用减法 比如 ...
- css3圆角(还有百分比设置椭圆) 阴影 字体
一. 现在前面只写知识点,全部内容放在后面截图展示: 给元素添加圆角: border-radius属性,他的值如果等于高的一半,将会等到一个圆形,大于一半叶然是一个圆形 radius是指半径,他求出圆 ...
- Pycharm快捷方式
PYCHARM的快捷方式 PyCharm3.0默认快捷键(翻译的)1.编辑(Editing)Ctrl + Space 基本的代码完成(类.方法.属性)Ctrl + Alt + Space 快速导入任意 ...
- [并查集] POJ 1182 食物链
食物链 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 66294 Accepted: 19539 Description ...
- 仓储管理系统500bug记录一下mysql 8小时超时解决办法
HTTP Status 500 - Request processing failed; nested exception is org.springframework.dao.TransientDa ...
