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 ...
随机推荐
- PC端和移动端一些奇葩兼容性问题
IE10默认在input框中输入内容时会显示一个'X',密码框会显示一个'小眼睛',怎么把这个默认的'X'或者'小眼睛'删除掉. 在password输入框显示一个“小眼睛”的按钮,去掉他的方法如下: ...
- 编译MVC解决方案老出现这个问题的原因
Server Error in '/' Application. The view at '~/Views/Home/Index.cshtml' must derive from WebViewPag ...
- 绑定多个ddl
添加材料,需要绑定材料类型.设备名称.省份和所属终端客户等信息,前台页面如下: 前台.aspx <asp:Content ID="Content2" ContentPlace ...
- Redis学习笔记~实现消息队列比MSMQ更方便
什么是队列:简单的说就是数据存储到一个空间里(可以是内存,也可以是物理文件),先存储的数据对象,先被取出来,这与堆栈正好相反,消息队列也是这样,将可能出现高并发的数据进行队列存储,并按着入队的顺序依次 ...
- 160809208沈昊辰c语言程序设计实验选择结构设计
<C语言程序设计>实验报告 学 号 160809208 姓 名 沈昊辰 专业.班 计科16-2班 学 期 2016-2017 第1学期 指导教师 黄俊莲 吴喆 实验地点 C区二层机房 ...
- Coding源码学习第四部分(Masonry介绍与使用(三))
接上篇继续进行Masonry 的学习. (12)tableViewCell 布局 #import "TableViewController.h" #import "Tes ...
- Python Day03
set Collections系列: Python拥有一些内置的数据类型,比如str, int, list, tuple, dict等, collections模块在这些内置数据类型的基础上,提供了几 ...
- php截取utf-8中文字符串乱码的解决方法
/** * PHP截取UTF-8字符串,解决半字符问题. * 英文.数字(半角)为1字节(8位),中文(全角)为2字节 * @return 取出的字符串, 当$len小于等于0时, 会返回整个字符串 ...
- svn图标不显示的解决方案
最近发现svn图标莫名其妙的不显示,其他操作都正常.在网上搜了一些方法. 解决方法一(失败): 升级最新版本,我的本来就是最新版本 解决方法二(失败): 右键->TortoiseSVN-> ...
- hibernate开发(2)
1 hibernate 的缓存机制 在程序运行中,hibernate要不断访问物理数据库,为了降低访问频率,提升性能,会复制一部分数据到缓存中,使得hibernate可以从缓存中读写数据,然后在特定时 ...