UIImagePickerControllerEditedImage //无法使用索引类型为“UIImagePickerController.InfoKey”的类型'[String:Any]’下标
func imagePickerController(_ picker: UIImagePickerController,dIDFinishPickingMediawithInfo info: [String : Any]) { if let pickedImage = info[UIImagePickerControllerEditedImage] as? UIImage { self.userProfileImage.contentMode = .scaleAspectFit self.userProfileImage.image = pickedImage } picker.dismiss(animated: true,completion: nil)}解决方法 方法签名已更改为
func imagePickerController(_ picker:UIImagePickerController,dIDFinishPickingMediawithInfo info:[UIImagePickerController.InfoKey:Any])
您应该看到func名称的警告消息
总结Instance method
‘imagePickerController(:dIDFinishPickingMediawithInfo:)’ nearly
matches optional requirement
‘imagePickerController(:dIDFinishPickingMediawithInfo:)’ of protocol
‘UIImagePickerControllerDelegate’CandIDate has non-matching type ‘(UIImagePickerController,[String :
Any]) -> ()’Move ‘imagePickerController(_:dIDFinishPickingMediawithInfo:)’ to
another extension to silence this warningMake ‘imagePickerController(_:dIDFinishPickingMediawithInfo:)’ private
to silence this warningRequirement ‘imagePickerController(_:dIDFinishPickingMediawithInfo:)’ declared here (UIKit.UIImagePickerControllerDelegate)
以上是内存溢出为你收集整理的Swift 4.2 imagePickerController问题全部内容,希望文章能够帮你解决Swift 4.2 imagePickerController问题所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)