[[NSBundle mainBundle]pathForResource..取值为空
2017-09-28 21:21
441 查看
转载至:http://blog.csdn.net/zww1984774346/article/details/78128148
最近遇到一个奇葩的问题,使用
这里提出一个解决方案仅供参考。
1、以实体文件的方式拖入图片文件夹
2、以实体文件的方式查找
如果以上方式还无法正确读取到文件可以继续下一步:
3、设置Bundle Resource, 选中工程->Build Phases->Copy Bundle Resources
再次尝试应该就阔以啦。
最近遇到一个奇葩的问题,使用
[[NSBundle mainBundle]pathForResource:imageName ofType:@"png"];获取图片一直取不到图片,简直晕死,一直好用的方法突然不行了,只能另寻它法了。
这里提出一个解决方案仅供参考。
1、以实体文件的方式拖入图片文件夹
2、以实体文件的方式查找
NSString *path = [[NSBundle mainBundle]pathForResource:imageName ofType:@"png" inDirectory:@"images"];1
如果以上方式还无法正确读取到文件可以继续下一步:
3、设置Bundle Resource, 选中工程->Build Phases->Copy Bundle Resources
再次尝试应该就阔以啦。
相关文章推荐
- [[NSBundle mainBundle]pathForResource..取值为空
- 关于[[NSBundle mainBundle] pathForResource:@"name" ofType:@"type"]找不到指定文件的解决办法
- iOS开发 [NSBundle mainBundle] 通过pathForResource返回路径为空.
- NSBundle mainBundle] pathForResource 返回nil的解决办法
- [[NSBundle mainBundle]pathForResource:@"XXX" ofType:@"db"]为nil的解决办法
- [[NSBundle mainBundle] pathForResource:@"name" ofType:@"type"] 找不到对应的文件解决方法
- iOS [[NSBundle mainBundle] pathForResource:@"" ofType:@""]无法获取到文件
- 关于[[NSBundle mainBundle] pathForResource:@"name"
- 关于[[NSBundle mainBundle] pathForResource:@"name" ofType:@"type"]找不到指定文件的解决办法
- iOS开发中 [[NSBundle mainBundle] pathForResource: ofType:]路径为空的问题
- iOS开发.[NSBundle mainBundle] 通过pathForResource返回路径为空.
- iOS问题笔记-[[NSBundle mainBundle] pathForResource: ofType:]方法获取不到资源路径
- 关于[[NSBundle mainBundle] pathForResource:@"name" ofType:@"type"]找不到指定文件的解决办法
- 关于[[NSBundle mainBundle] pathForResource:@"name" ofType:@"type"]找不到指定文件的解决办法
- [[NSBundle mainBundle]pathForResource:@"name" ofType:@"type"] 获取不到本地文件
- [NSBundle mainBundle] pathForResource: ofType: 获取不到数据
- [NSBundle mainBundle] pathForResource: ofType: 获取不到数据
- 关于[[NSBundle mainBundle] pathForResource:@"name" ofType:@"type"]找不到指定文件的解决办法
- NSBundle pathForResource取不到值如何解决?
- NSBundle pathForResource取不到值如何解决?