帮助!我可以在 iOS 模拟器上播放声音,但不能在我的设备上播放!这是我的代码(是的,音频文件在指定的位置,它肯定有效:
SystemSoundID hashtag;
NSString *path = [[NSBundle mainBundle] pathForResource:@"hashtag" ofType:@"wav"];
NSURL *pathURL = [NSURL fileURLWithPath:path];
AudioServicesCreateSystemSoundID((__bridge CFURLRef) pathURL, &hashtag);
AudioServicesPlaySystemSound(hashtag);