Swift3 我怎样才能解决这个问题;init(URL:)已重命名为init(URL:)";我的xcode 8项目中有错误吗?

Swift3 我怎样才能解决这个问题;init(URL:)已重命名为init(URL:)";我的xcode 8项目中有错误吗?,swift3,xcode8,Swift3,Xcode8,我怎样才能修好这台机器 init(URL:)已重命名为init(URL:) 我的Xcode 8项目中有错误吗? 这是我的代码: override func viewDidLoad() { super.viewDidLoad() // Load the video from the app bundle. let videoURL: NSURL = Bundle.main.url(forResource: "IMG_4628", withExtensio

我怎样才能修好这台机器

init(URL:)已重命名为init(URL:)

我的Xcode 8项目中有错误吗? 这是我的代码:

 override func viewDidLoad() {
            super.viewDidLoad()

    // Load the video from the app bundle.
    let videoURL: NSURL = Bundle.main.url(forResource: "IMG_4628", withExtension: "mp4")! as NSURL

    player = AVPlayer (URL: videoURL)
    player?.actionAtItemEnd = .none
    player?.isMuted = true

    let playerLayer = AVPlayerLayer(player: player)
    playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
    playerLayer.zPosition = -1

    playerLayer.frame = view.frame

    view.layer.addSublayer(playerLayer)

    player?.play()

    //loop video
如何修复行
player=AVPlayer(URL:videoURL)
中的错误?
谢谢。

您应该在初始值设定项中将大写的
URL
替换为
URL

player = AVPlayer(url: videoURL)

只需替换为以下代码

player=AVPlayer(url:videoURL!作为url)