简体   繁体   English

'seek(to:)' 在 iOS 11.0 中已弃用:

[英]'seek(to:)' was deprecated in iOS 11.0:

Getting this warning:收到此警告:

'seek(to:)' was deprecated in iOS 11.0: Use -seekToTime:completionHandler:, passing nil for the completionHandler if you don't require notification of completion 'seek(to:)' 在 iOS 11.0 中已弃用:使用 -seekToTime:completionHandler:,如果您不需要完成通知,则为 completionHandler 传递 nil

written in this particular line of block of code:写在这行特定的代码块中:

    @objc func playerItemDidReachEnd(notification: Notification) {
        let p: AVPlayerItem = notification.object as! AVPlayerItem
        p.seek(to: .zero)
    }

Any help with this will be much appreciated对此的任何帮助将不胜感激

In the documentation you can see that seek(to:) has been deprecated.在文档中,您可以看到seek(to:)已被弃用。 You need to use seek(to: , completionHandler:) .您需要使用seek(to: , completionHandler:) If you don't want to use a completion handler, you just pass a nil :如果您不想使用完成处理程序,则只需传递一个nil

seek(to: .zero, completionHandler: nil)

https://developer.apple.com/documentation/avfoundation/avplayeritem https://developer.apple.com/documentation/avfoundation/avplayeritem

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM