title: Swift: Thread 1 signal SIGABRT in class AppDelegate: UIResponder, UIApplicationDelegate
body: <p>Whenever I try to open a different view controller with a show segue it crashes with this error Swift: Thread 1 signal SIGABRT in class AppDelegate: UIResponder, UIApplicationDelegate, I don't know why.</p>
  
  <p>Here's the code of the View Controller that I try to open:</p>
  
  <pre><code>import UIKit
  import CoreData
  
  class AddEditVC: UIViewController, NSFetchedResultsControllerDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
  
  
  var item : Item? = nil
  
  @IBOutlet weak var itemName: UITextField!
  @IBOutlet weak var imageHolder: UIImageView!
  
   let moc = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      if item != nil {
          itemName.text = item?.name
          imageHolder.image = UIImage(data: (item?.image)!)
      }
  
  
      // Do any additional setup after loading the view.
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  @IBAction func addImage(sender: AnyObject) {
      let pickerController = UIImagePickerController()
      pickerController.delegate = self
      pickerController.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
      pickerController.allowsEditing = true
  
      self.presentViewController(pickerController, animated: true, completion: nil)
  
  }
  
  
  @IBAction func addImageFromCamera(sender: AnyObject) {
      let pickerController = UIImagePickerController()
      pickerController.delegate = self
      pickerController.sourceType = UIImagePickerControllerSourceType.Camera
      pickerController.allowsEditing = true
  
      self.presentViewController(pickerController, animated: true, completion: nil)
  }
  
  func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {
      self.dismissViewControllerAnimated(true, completion: nil)
  
      self.imageHolder.image = image
  }
  
  @IBAction func saveTapped(sender: AnyObject) {
  
      if item != nil {
          editItem()
      } else {
          createNewItem()
      }
  }
  
  func createNewItem() {
  
      let entityDescription = NSEntityDescription.entityForName("Item", inManagedObjectContext: moc)
      let item = Item(entity: entityDescription!, insertIntoManagedObjectContext: moc)
      item.name = itemName.text
      item.image = UIImagePNGRepresentation(imageHolder.image!)
  
      do {
          try moc.save()
      } catch {
          return
      }
  }
  func editItem () {
  
      item?.name = itemName.text
      item!.image = UIImagePNGRepresentation(imageHolder.image!)
  
      do {
          try moc.save()
      } catch {
          return
      }
  
  }
  </code></pre>