3
我发现了一个功能使用工具箱播放声音,creds打算给谁就给谁创造了它:在iPad上播放声音,使用AudioToolbox
-(SystemSoundID) createSoundID: (NSString*)name {
NSString *path = [NSString stringWithFormat: @"%@/%@",
[[NSBundle mainBundle] resourcePath], name];
NSURL* filePath = [NSURL fileURLWithPath: path isDirectory: NO];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
NSLog(@"%@, %@", path, filePath);
return soundID;
}
然而,一旦我想要的声音播放和我使用的功能
mySound = [self createSoundID: @"canopen.wav"];
AudioServicesPlaySystemSound(mySound);
它只在模拟器中播放,而不是一旦我将它移动到iPad。请帮忙
难道你的iPad是静音的吗? – Phlibbo
Dupe?你的声音太长了吗? http://stackoverflow.com/questions/2014578/sound-on-simulator-but-not-device –
是的!哈哈声音已打开,但侧面的按钮已关闭! xD谢谢! – user981320