IOS添加资源文件并打印资源文件路径到LOG

1. 项目文件列表右击-->Add Files to -->选择要添加的资源文件,如test.mp4

2. 取路径:NSString *path = [[NSBundle mainBundlepathForResource:@"test" ofType:@"mp4"];

3. 转换为字符串:char *szpath= [path UTF8String];

4. 打印LOG:NSLog(@"path: %s",[path UTF8String]);

5. 也可使用C语言打印:printf("%s\r\n", [path UTF8String]);

猜你喜欢

转载自blog.csdn.net/llxxhm/article/details/82495763