mercredi 5 août 2015

Errors in retrieving all Parse data from a class


I am retrieving multiple items from Parse and would like to loop through them and add them to an array. Below is my code. I have several errors:

  Cannot invoke append with an argument list of type '(String)'
  Argument for generic parameter 'T' could not be inferred

//end errors

var query = PFQuery(className:"myClass")
    query.findObjectsInBackgroundWithBlock {
        (objects: [AnyObject]?, error: NSError?) -> Void in

    if error == nil {
    // The find succeeded.
    // Do something with the found objects
    if let objects = objects as? [PFObject] {

                for object in objects {


if let stringObject = object["values"] as? String {
                            self.myArray.append(stringObject)
                        }
                    }

                    }


        } else {

            println("Error: \(error!) \(error!.userInfo!)")
        }
    }

I'd be grateful for any help.

Here is where I create the array:

var myArray: Array = [String]()



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire