简体   繁体   中英

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. However when i implement the sample code, found here , i get the following error:

Type 'changeCoverViewController' does not conform to protocol 'ImagePickerDelegate'

on line one of the code:

class changeCoverViewController: UIViewController, ImagePickerDelegate {

You are probably missing one of the required ImagePickerDelegate functions. 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. In this case:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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