First off this was the video tutorial I was trying to follow Xcode 7.2 Swift 2 Tutorial: iOS 9 UIImagePickerController - YouTube. I have just recenlty installed the new Xcode update. So I am working with swift 3.
All this video has is a image picker, a camera, and a load photo gallery. I was able to load a photo from my saved album but I was not able to use the camera feature. If I had used the camera feature it gave me a sigabrt error. I also can’t access my photo gallery anymore either within the app. All I am looking for is a exact replica of what the youtube videos tutorial represents. I have also put my view control code below. Thanks.
import UIKit
class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate{
@IBOutlet weak var x: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func camera(_ sender: AnyObject) {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.camera
present(imagePicker, animated: true, completion: nil)
}
@IBAction func savedphotos(sender: AnyObject) {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.photoLibrary
present(imagePicker, animated: true, completion: nil)
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {
x.image = image
self.dismiss(animated: true, completion: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}