title: Swift: Cannot assign a value of type 'Any' to a value of type 'AnyObject?'
body: <p>I habe written a function, that updates data in parse</p>
  
  <pre><code>    func updateParse(className: String, whereKey: String, equalTo: String, updateData: Dictionary&lt;String, Any&gt;) {
  
      let query = PFQuery(className: className)
  
      query.findObjectsInBackgroundWithBlock {
          (objects, error) -&gt; Void in
  
          if error == nil {
              if let objects = objects as? [PFObject] {
                  for object in objects {
                      query.getObjectInBackgroundWithId(object.objectId!){
                          (prefObj, error) -&gt; Void in
                          if error != nil {
                              print(error)
                          } else if let prefObj = prefObj {
  
                                  for (key, value) in updateData {
  
                                      prefObj[key] = value // Cannot assign a value of type 'Any' to a value of type 'AnyObject?'
  
                                  }
                              prefObj.saveInBackground()
                          }
                      }
                  }
              }
          } else {
              print("Error: \(error!)")
          }
  
      }
  
  }
  </code></pre>
  
  <p>i call it with</p>
  
  <pre><code>let imageData = UIImagePNGRepresentation(self.uploadPreviewImage.image!)
  let parseImageFile =  PFFile(name: "userProfileImage.png", data: imageData!)
  
  updateParse("ProfileImages", whereKey: "uploader", equalTo: "Phil", updateData: ["imageFile":parseImageFile])
  </code></pre>
  
  <p>I have commented the error in the corresponding line.
  It is important to note that the type is not always a picture. Sometimes a string.</p>