对于var testAudio我的iPhone应用程序中的声明,我在这里收到错误
"调用可以抛出,但错误不能从属性初始化程序中抛出"
import UIKit
import AVFoundation
class ViewController: UIViewController {
var testAudio = AVAudioPlayer(contentsOfURL: NSURL (fileURLWithPath: NSBundle.mainBundle().pathForResource("testAudio", ofType: "wav")!), fileTypeHint:nil)
Run Code Online (Sandbox Code Playgroud)
当我转到Xcode 7测试版时,就发生了这种情况.
如何在Swift 2.0中使用此音频剪辑?