【发布时间】:2014-10-25 20:32:15
【问题描述】:
这是我的代码,正在播放声音,但在我更新到 xcode 6.1 后出现此错误
调用中的额外参数“contentsOfURL”
var alertSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("sound", ofType: "aiff")!)
//println(alertSound);
// Removed deprecated use of AVAudioSessionDelegate protocol
AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, error: nil)
AVAudioSession.sharedInstance().setActive(true, error: nil)
var error:NSError?;
audioPlayer = AVAudioPlayer(contentsOfURL: alertSound, error: &error); // the error
audioPlayer.prepareToPlay();
如何修复错误并让 xcode 停止显示它
【问题讨论】: