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 ...
随机推荐
- ios基础篇(二十五)—— Animation动画(UIView、CoreAnimation)
Animation主要分为两类: 1.UIView属性动画 2.CoreAnimation动画 一.UIView属性动画 UIKit直接将动画集成到UIView类中,实现简单动画的创建过程.UIVie ...
- [转] 微软源代码管理工具TFS2013安装与使用详细图文教程(Vs2013)
这篇文章联合软件小编主要介绍了微软源代码管理工具TFS2013安装与使用图文教程,本文详细的给出了TFS2013的安装配置过程.使用教程,需要的朋友可以参考下 最近公司新开发一个项目要用微软的TFS2 ...
- json序列化时datetime的处理方法
.net自带的json序列化器,JavaScriptSerializer和DataContractJsonSerializer,都是序列化成微软的datetime json格式,e.g. " ...
- cacti web页面访问 settings出错
查看apache错误日志: 错误信息Mon Dec 26 11:00:48.241653 2016] [:error] [pid 32607] [client 192.168.10.79:65009] ...
- 学习docker
虚拟机下Ubuntu环境 1.sudo apt-get update 2.sudo apt-get install docker.io 3.在daocloud(http://www.daocloud. ...
- Flapper Bird的学习笔记(二)
因为有一个超屌的梦想,所以就绝不会做一个孬种的追梦人! 本章节主要目的: 实现小鸟的飞行. 实现管道的随机出现. 实现相机跟随. 上次主要是场景的布置,这节全力拿下代码. 1.小鸟飞行(一种制作2D动 ...
- Paths_Quartz2D
Paths中的几个重要元素 Points void CGContextMoveToPoint ( CGContextRef c, CGFloat x, CGFloat y ); 指定 ...
- 清除Linux OS 缓存
1.查看内存使用情况 [root@ip---- tpch_2_17_0]# free -m total used free shared buffers cached Mem: -/+ buffers ...
- CentOS 6.6编译安装Nginx1.6.2+MySQL5.6.21+PHP5.6.3
http://www.osyunwei.com/archives/8867.html 一.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables #编辑防火墙配置 ...
- com.android.internal.os.ZygoteInit$MethodAndArgsCaller 解决
好久没写博客了,带着点小愧疚来,添上几个字: 这是今天遇到的一个bug,之前也遇到过,为了后面方便,就记下. bug提示:com.android.internal.os.ZygoteInit$Meth ...
