iOS 项目的文件 获取路径为nil

来源:互联网 发布:spark sql window 编辑:程序博客网 时间:2024/06/05 15:11

返比如我拖进工程一个文件123.mp4,使用如下方法获取

  NSString *filePath = [[NSBundle mainBundle] pathForResource:@"123" ofType:@"mp4"];    NSLog(@"%@",filePath);
filePath =(null)

解决方法:点击项目 -> TARGETS -> Build Phases -> Copy Bundle Resource
将123.mp4加进来。

原创粉丝点击