问题描述
- Xcode7.0.1问题,无法构建
-
import UIKit
import AVFoundationclass ViewController: UIViewController {
var APlayer:AVAudioPlayer! @IBAction func PlayBtnClicked(sender: AnyObject) { APlayer.play() } @IBAction func PauseBtnClicked(sender: AnyObject) { APlayer.pause() } @IBAction func StopBtnClicked(sender: AnyObject) { APlayer.stop() APlayer.currentTime = 0 } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. _APlayer = AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("Mirror Night", ofType: "mp3")!)) }_//此处有错误提示"call can throw,but it is not marked with 'try' and the error is nothandled" override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. }
解决方案
你搜一下swift2.0异常处理机制。一句两句说不完
时间: 2024-09-27 13:41:46