NSString *cafPath = [[NSBundle mainBundle]pathForResource:@"selected" ofType:@"caf"];
NSString *wavPath = [[NSBundle mainBundle]pathForResource:@"button" ofType:@"wav"];
NSString *imagePath = [[NSBundle mainBundle]pathForResource:@"bug" ofType:@"png"];
NSLog(@"%@",cafPath);
NSLog(@"%@",wavPath);
NSLog(@"%@",imagePath);
我在工程的同一个目录下添加了三个文件,格式分别为caf,wav,png。我在输出的结果却是
(null)
2015-07-17 15:33:40.166 Circle[9952:233729] /Users/danis/Library/Developer/CoreSimulator/Devices/4503EAB4-094C-4E24-B99B-158539A5F52C/data/Containers/Bundle/Application/C29CE31D-6D24-4D6F-951C-E5418073D20A/Circle.app/button.wav
2015-07-17 15:33:40.166 Circle[9952:233729] /Users/danis/Library/Developer/CoreSimulator/Devices/4503EAB4-094C-4E24-B99B-158539A5F52C/data/Containers/Bundle/Application/C29CE31D-6D24-4D6F-951C-E5418073D20A/Circle.app/bug.png
也就是说第一个caf格式的音频没能读出来,这是什么问题啊,重点是同一个文件夹下啊!!!
xcode 傻逼的编译问题,clean 掉就ok了
clean 后 还是nil。。。。