AVAudioPlayer *player;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory,NSUserDomainMask, YES);
NSString *dir = [paths objectAtIndex:0];
dir = [dir stringByAppendingPathComponent:targetSound];
NSURL *url = [NSURL fileURLWithPath:dir isDirectory:YES];
[player setDelegate:self];
player = [[AVAudioPlayer alloc]initWithData:data error:nil];
[player play];
这是我的代码。 Xcode没有任何错误,但没有任何声音出现。
需要你的帮助,提前谢谢...
答案 0 :(得分:0)
我认为你在NSDocumentationDirectory
到NSDocumentDirectory