【发布时间】:2016-02-20 19:05:26
【问题描述】:
请帮帮我!!!我最近才开始使用 Swift 编程。这是我的第一个项目。我收到错误消息:“调用中的参数标签不正确”。这是我的代码:
import UIKit
import AVFoundation
class PlaySoundsViewController: UIViewController {
var audioPlayer:AVAudioPlayer!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
if var filePath = NSBundle.mainBundle().pathForResource("psl",ofType: "mp3"){
var filePathUrl = NSURL.fileURLWithPath(filePath)
audioPlayer = AVAudioPlayer(contentsOfURL: filePathUrl, error: nil)
}else {
print("the filepath is empty")
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func playSoundSlow(sender: UIButton) {
audioPlayer.play()
我不确定这里出了什么问题是我的代码的另一张图片,所以你也可以看到错误消息。My Code
我正在尝试让它播放名为 psl.mp3 的 mp3。 请帮我!!!我刚开始,不知道该怎么办。
附:不是以英语为母语,如有错误请见谅。
【问题讨论】:
标签: swift error-handling swift2