iPhone4S with iOS6 AVAudioPlayer is working, but no sound

让人想犯罪 __ 提交于 2019-12-02 01:33:42

问题


I created a simple audio app which plays a mp3 file. It works with no problem on Simulator(iOS 5 and 6) and iPod3GS (with iOS 5.1). But when I tried on my iPhone4S(iOS 6), it seems to work but doesn't sound anything.

"[audioPlayer duration]" gives me right value, and even "audioPlayerDidFinishPlaying" message of delegate shows the right finishing of play after duration time.

My iPhone4S works with no problem in other sound apps like Music, Video or Podcast. Only it can't sound with my own custom app.

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"banana" ofType:@"mp3"]];
NSError *error;
if (error) {
    NSLog(@"error in audioPlayer:%@", [error localizedDescription]);
}
else {
    self.audioPlayer.delegate = self;
    [self.audioPlayer prepareToPlay];
}

Is it simply a device problem or is there any clue about this problem? Anyone had the similar experience?

I reset setting values on my phone and I rebooted it, but still the same problem. I tested with mp3, wav and aiff files.


回答1:


Turn the silencer off.

And double-check that you have both volumes turned up.



来源:https://stackoverflow.com/questions/13109326/iphone4s-with-ios6-avaudioplayer-is-working-but-no-sound

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