請幫我編輯我的代碼。我似乎無法解決這個錯誤。Xcode swift - 未解決的標識符錯誤
import UIKit
import AVKit
import AVFoundation
import MediaPlayer
class ViewController: UIViewController {
let avPlayerViewControler = AVPlayerViewController()
var avPlayer:AVPlayer?
var videoNumber:Int!
var url:String!
override func viewDidLoad() {
super.viewDidLoad()
let urlpathString:String? = NSBundle.mainBundle().pathForResource("url", ofType: "mp4")
if let urlPath = urlpathString {
switch videoNumber {
case 1 : url="20"
case 2 : url="10"
default : break
}
let movieUrl = NSURL(fileURLWithPath: urlPath)
}
self.avPlayer = AVPlayer(URL: movieUrl)
self.avPlayerViewControler.player = self.avPlayer
}
@IBAction func Cool(sender: UIButton) {
videoNumber=1
}
}
那麼,哪個標識符? – Alexander
Self.avPlayer = AVPlayer(URL:urlPath) –
'movieUrl'超出範圍... – Moritz