将一个文件导入到工程中后,用[[NSBundle mainBundle] pathForResource:@"" ofType:@""]来获取到该文件时,一直无法拿到这个文件,解决方法如下

在Build Phases -> Copy Bundle Resources下点击加号(+)

iOS [[NSBundle mainBundle] pathForResource:@"" ofType:@""]无法获取到文件

选择刚刚添加进工程的文件,店家add

iOS [[NSBundle mainBundle] pathForResource:@"" ofType:@""]无法获取到文件

这样就可以用[[NSBundle mainBundle] pathForResource:@"" ofType:@""]方法获取到这个文件了

相关文章:

  • 2021-10-09
  • 2021-07-15
  • 2022-12-23
  • 2021-08-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-17
猜你喜欢
  • 2021-12-12
  • 2021-08-11
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
  • 2022-12-23
相关资源
相似解决方案