gpt4 book ai didi

ios - UIImagePickerControllerDelegate didFinishPickingMediaWithInfo 给我一个错误

转载 作者:行者123 更新时间:2023-11-28 11:40:33 24 4
gpt4 key购买 nike

我正在尝试从设备获取图像和视频并尝试声明 UIImagePickerDelegateUINavigationControllerDelegate 但在线 guard let...,它给我一个错误:

Cannot subscript a value of type '[String: Any]' with an index of type 'UIImagePickerController.InfoKey'

let url = info... 这行,它给了我同样的错误。

我该如何处理?

//UIImagePickerControllerDelegate
extension SecondViewController: UIImagePickerControllerDelegate {
private func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {

guard let mediaType = info[UIImagePickerControllerMediaType] as? String,
mediaType == (kUTTypeMovie as String),
let url = info[UIImagePickerControllerMediaURL] as? URL
else { return }

dismiss(animated: true) {
let player = AVPlayer(url: url)
let vcPlayer = AVPlayerViewController()
vcPlayer.player = player
self.present(vcPlayer, animated: true, completion: nil)
}
}
}

//UINavigationControllerDelegate
extension SecondViewController: UINavigationControllerDelegate {
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com