简体   繁体   English

类型不符合协议“ImagePickerDelegate”

[英]Type does not conform to protocol 'ImagePickerDelegate'

I'm using a library called ImagePicker from github to get images from the user and upload them.我正在使用来自 github 的名为ImagePicker的库从用户那里获取图像并上传它们。 However when i implement the sample code, found here , i get the following error:但是,当我实现此处找到的示例代码时,出现以下错误:

Type 'changeCoverViewController' does not conform to protocol 'ImagePickerDelegate'类型“changeCoverViewController”不符合协议“ImagePickerDelegate”

on line one of the code:在线代码之一:

class changeCoverViewController: UIViewController, ImagePickerDelegate {

You are probably missing one of the required ImagePickerDelegate functions.您可能缺少所需的ImagePickerDelegate函数之一。 Specifically these:具体这些:

func wrapperDidPress(imagePicker: ImagePickerController, images: [UIImage])
func doneButtonDidPress(imagePicker: ImagePickerController, images: [UIImage])
func cancelButtonDidPress(imagePicker: ImagePickerController)

In the future if you notice this error again go to the declaration of the delegate and you'll see a class protocol and that'll tell you what is required to implement said delegate.将来,如果您再次注意到此错误,请转到委托的声明,您将看到一个类protocol ,它会告诉您实现所述委托需要什么。 In this case:在这种情况下:

public protocol ImagePickerDelegate: class {
  func wrapperDidPress(imagePicker: ImagePickerController, images: [UIImage])
  func doneButtonDidPress(imagePicker: ImagePickerController, images: [UIImage])
  func cancelButtonDidPress(imagePicker: ImagePickerController)
}

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

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