我想用AVAudioPlayer播放我的服务器上的mp3文件我试过这段代码,但它不起作用。我想用AVAudioPlayer在我的服务器上播放mp3文件
-(IBAction)playSound {
NSString *path = [[NSBundle mainBundle] pathForResource:@"http://www.domain.com/audio/test.mp3"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
[theAudio play];
}
欢迎计算器!我冒昧地重新格式化您的代码。你可能想告诉我们更多关于你的问题,特别是为什么它不起作用。你会得到什么错误信息?什么规格(配置,编译或执行)错误发生?你为什么认为你的榜样应该工作? – phihag 2010-07-17 20:49:49