I've recently updated to Swift 3 in Xcode 8 using the developer beta.
I'm trying to implement Firebase Auth, and everything's going well.
My Problem:
I'm trying to upload an image as a user's profile picture to a Firebase database.
I thought I could use the UIImagePickerController
to do this, but when I do, I get a
"Thread 7: Signal SIGABRT
I know what this would normally indicate, but I checked, and my image does indeed print my test statement when I tap it.
My failed method:
ViewController.swift
import UIKit
import Firebase
import Photos
class ViewController: UIViewController, UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate{
@IBOutlet weak var imageView: UIImageView!
@IBOutlet var emailTextField: UITextField!
@IBOutlet var passWordTextField: UITextField!
@IBOutlet var nameTextField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
if FIRAuth.auth()?.currentUser?.uid != nil {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let view = storyboard.instantiateViewController(withIdentifier: "ProfileViewController")
self.present(view, animated: true, completion: nil)
}
imageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleSelectProfileImageView)))
imageView.isUserInteractionEnabled = true
self.emailTextField.delegate = self;
self.passWordTextField.delegate = self;
self.nameTextField.delegate = self;
}
func handleSelectProfileImageView() {
let picker = UIImagePickerController()
picker.delegate = self
picker.allowsEditing = true
present(picker, animated: true, completion: nil)
}
I'm not sure yet if this is just a problem with Swift 3 and the developer Xcode 8 beta, or if I'm just doing it the wrong way for swift 3.
EDIT:
I'm using the GM Version of xcode8, but still get that same error.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…