I'm just following the official Apple introduction tutorial for Swift and Xcode by making a FoodTracker app. I've got this error (see title).
This is Xcode 7.2.1 I have imported UIKit
Here's the code I have where the issue appears. I have all class protocols and delegates and everything.
@IBAction func selectImageFromPhotoLibrary(sender: UITapGestureRecognizer) {
nameTextField.resignFirstResponder()
// UIImagePickerController is a view controller that lets a user pick media from their library.
let imagePickerController = UIImagePickerController()
// Only allow photos to be picked, not taken.
imagePickerController.sourceType = .PhotoLibrary
// Make sure ViewController is notified when the user picks an image.
imagePickerController.delegate = self
present(imagePickerController, animated: true, completion: nil)
}
I would appreciate any help since I just started learning this language!
in your case (you are using xcode 7 -> swift 2) it has to be:
presentViewController(imagePickerController, animated: true, completion: nil)
right now you are using swift3 syntax.