AVFoundation sound working on iOS 6 simulator but not device?

不想你离开。 提交于 2019-12-10 16:43:53

问题


Help! I can play sound on the iOS simulator, but not my device! Here is my code (yes, the audio file is in the specified location, it definitely works:

SystemSoundID hashtag;

NSString *path  = [[NSBundle mainBundle] pathForResource:@"hashtag" ofType:@"wav"];

NSURL *pathURL = [NSURL fileURLWithPath:path];
AudioServicesCreateSystemSoundID((__bridge CFURLRef) pathURL, &hashtag);
AudioServicesPlaySystemSound(hashtag);

回答1:


Two suggestions, and I have had the same problem caused by both!

1) The ios device is case sensitive when it comes to file names whilst the simulator is not. 2) Is your device muted? This sound stupid, but it is the number one cause of bug reports on an app I use AVFoundation in!



来源:https://stackoverflow.com/questions/12487080/avfoundation-sound-working-on-ios-6-simulator-but-not-device

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!