AVAudioPlayer在Ipod Touch 4g中正常播放音频但不在Ipad,Ipad2中,为什么?

时间:2012-02-01 15:10:19

标签: objective-c ios ipod-touch

这是我的代码:

NSError *error;
NSString* path = [[NSBundle mainBundle] pathForResource:[settings alarmAudioName] ofType:@"mp3"];
NSLog(@"%@",path);
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
NSLog(@"%@",[NSURL fileURLWithPath:path]);
if (audioPlayer == nil) 
    NSLog(@"%@", [error description]);
else
{
    [audioPlayer prepareToPlay];
    [audioPlayer play];
    NSLog(@"Should have been played");
}

的NSLog:

/var/mobile/Applications/9B5B4E10-A936-4D90-8CBE-17854A0B22F7/SSCA Development.app/Song 1.mp3
file://localhost/var/mobile/Applications/9B5B4E10-A936-4D90-8CBE-17854A0B22F7/SSCA%20Development.app/Song%201.mp3

它的工作在Ipod Touch 4g中是正确的,但不能在Ipad,Ipad2中工作,为什么?

谢谢你的回答,

0 个答案:

没有答案