swift - 如何解决:“无法将 'SelfieListViewController' 类型的值分配给类型 '(UIImagePickerControllerDelegate & UINavigationControllerDelegate)?'”
问题描述
我收到此错误:无法将类型“SelfieListViewController”的值分配给类型“(UIImagePickerControllerDelegate & UINavigationControllerDelegate)?”
对于此功能:
@objc func createNewSelfie()
{
//Create a new image picker
let imagePicker = UIImagePickerController()
//If a camera is a available, use it; otherwise, use the photo library
if UIImagePickerController.isSourceTypeAvailable(.camera)
{
imagePicker.sourceType = .camera
//If the front-facing camera is available, use that
if UIImagePickerController.isCameraDeviceAvailable(.front)
{
imagePicker.cameraDevice = .front
}
}
else
{
imagePicker.sourceType = .photoLibrary
}
//We want this object to be notified when the user takes a photo
imagePicker.delegate = self
//Present the image picker
self.present(imagePicker, animated: true, completion: nil)
}
解决方案
推荐阅读
- java - Spring Boot嵌入式tomcat ServerProperties bean不起作用
- apache-kafka - 无法删除 cloudera 中的默认 kafka 配置
- git - 保存 git log 文件(带有标签,因为它们丢失了)
- javascript - 延迟javascript循环延迟
- visual-studio-code - 为什么带有远程工作区的扩展不工作?
- c# - c# json 只合并值(忽略缺失的字段)
- aurelia - 使用 Aurelia Store 在 Actions 中复制状态的最佳方式是什么?
- javascript - 在网格中显示组合框值的问题
- python - 检查传递给函数的关键字参数的真实性不能按预期工作 - 为什么?
- jquery - 文本溢出省略号和扩展不起作用