iPhone4S with iOS6 AVAudioPlayer is working, but n

2020-04-16 05:51发布

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条回答
放我归山
2楼-- · 2020-04-16 06:14

Turn the silencer off.

side view showing silence switch

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

查看更多
登录 后发表回答