title: Write data to Firebase not working - Cannot convert value of type 'user' to expected argument type 'AnyObject?'
body: <p>I am trying to save my registered data to Firebase but get a "Cannot convert value of type 'user' to expected argument type 'AnyObject?'" error. I tried many things but I can't seem to figure it out...can someone help me please? how do it save it?</p>
  
  <pre><code>import UIKit
  import Firebase
  import FirebaseDatabaseUI
  
  class EventViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
  
      //outlets for text &amp; image
      @IBOutlet weak var photoImageView: UIImageView!
  
      @IBOutlet weak var eventName: UITextField!
      @IBOutlet weak var eventDate: UITextField!
      @IBOutlet weak var eventDes: UITextView!
  
  
  
      //Database connection
      let rootref = FIRDatabase().reference()
      var imagePicker: UIImagePickerController = UIImagePickerController()
  
  
  
      override func viewDidLoad() {
          super.viewDidLoad()
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
      }
  
      @IBAction func submitEvent(sender: AnyObject) {
  
          let name = eventName.text
          let date = eventDate.text
          let text = eventDes.text
          var data: NSData = NSData()
  
          if let image = photoImageView.image {
              data = UIImageJPEGRepresentation(image,0.1)!
          }
  
           let base64String = data.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.Encoding64CharacterLineLength)
  
          if let unwrappedName = name , unwrappedDate = date, unwrappedText = text{
              let user: NSDictionary = ["name":unwrappedName, "date":unwrappedDate, "text":unwrappedText, "photoBase64":base64String]
          }
  
          //Add firebase child node
          let event = FIRDatabase().reference().child(name!)
  
          // Write data to Firebase
  
          event.setValue(user.init())
  
          navigationController?.popViewControllerAnimated(true)
      }
  
      override func touchesBegan(touches: Set&lt;UITouch&gt;, withEvent event: UIEvent?) {
          view.endEditing(true)
          super.touchesBegan(touches, withEvent: event)
      }
  
          //UIImagePickerControllerDelegate methods
  
          func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
              imagePicker.dismissViewControllerAnimated(true, completion: nil)
              photoImageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage
          }
  
          func imagePickerControllerDidCancel(picker: UIImagePickerController) {
              dismissViewControllerAnimated(true, completion: nil)
          }
  
      @IBAction func addPicture(sender: AnyObject) {
          if(UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera)) {
              imagePicker =  UIImagePickerController()
              imagePicker.delegate = self
              imagePicker.sourceType = .Camera
  
              presentViewController(imagePicker, animated: true, completion: nil)
          } else {
              imagePicker.allowsEditing = false
              imagePicker.sourceType = .PhotoLibrary
              imagePicker.delegate = self
              presentViewController(imagePicker, animated: true, completion:nil)
          }
      }
  }
  </code></pre>