从bundle中获取数据,明明把数据添加到项目中了,但就是不对。
NSString *newDataName = [[NSBundle mainBundle] pathForResource:dataName ofType:format]; 为空
后来从网上查到相关信息,当时添加是直接拖拽过去,没有真正加入到bundle中,需要在项目设置中,build phases-》copy bundle resources 下面添加自己的数据就可以了。
记录一下。
本文介绍了解决iOS开发中资源文件未能正确加载到Bundle的问题。通过将资源文件手动添加到项目的Copy Bundle Resources阶段,确保资源被正确打包。
从bundle中获取数据,明明把数据添加到项目中了,但就是不对。
NSString *newDataName = [[NSBundle mainBundle] pathForResource:dataName ofType:format]; 为空
后来从网上查到相关信息,当时添加是直接拖拽过去,没有真正加入到bundle中,需要在项目设置中,build phases-》copy bundle resources 下面添加自己的数据就可以了。
记录一下。
3万+

被折叠的 条评论
为什么被折叠?