0

I was following this tutorial to create a image picker which is accessed from a UITableViewController. However it fails to compile in this line:

imagePicker.delegate = self

With this error:

Cannot assign value of type 'ProfileTableViewController' to type 'protocol<UIImagePickerControllerDelegate, UINavigationControllerDelegate>?'

How do I solve this? My class:

class ProfileTableViewController: UITableViewController,UIGestureRecognizerDelegate,UIImagePickerControllerDelegate {
override func viewDidLoad() {
      imagePicker.delegate = self
}
6
  • Where is your UINavigationControllerDelegate, you need to inherit it. Commented Apr 12, 2016 at 6:58
  • just add UINavigationControllerDelegate after UIImagePickerControllerDelegate in your viewcontroller Commented Apr 12, 2016 at 6:59
  • This is not the whole code, there are some code to create the UITableView. But what does a UINavigationControllerDelegate looks like? I dont have something like that. Commented Apr 12, 2016 at 6:59
  • stackoverflow.com/questions/29034987/… Commented Apr 12, 2016 at 7:00
  • It seems to work but I dont understand why. I didn't needed a UINavigationControllerDelegate before. So why do I need it after implementing image picker? Commented Apr 12, 2016 at 7:02

1 Answer 1

0

Implementing a UINavigationControllerDelegate to the class fixed the issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.