I am trying to query an array from Parse.com to an empty array.
My empty array:
var commentsArray = [NSArray]()
My query code:
var query1 = PFQuery(className: "currentUploads")
query1.whereKey("objectId", equalTo: "ImxZwVx7L8")
query1.findObjectsInBackgroundWithBlock{
(objects: [AnyObject]?, error: NSError?) -> Void in
if error == nil {
if let objects = objects as? [PFObject] {
for object in objects {
//For each object in the class object, append it to myArray
if let dataArray = object["comments"] as? NSArray {
self.commentsArray.append(dataArray)
println("codeBelow")
println(self.commentsArray)
println(self.commentsArray.count)
}
}
}
} else {
println("\(error?.userInfo)")
}
}
In the output I get this:
codeBelow
[(
abc,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
def,
tdrthdrthdrthdrthdrhtrthdrthdrthdrthdrthdrthdrthdrthdrth,
"jdrthdrthdrthdrthdrthdrthdrthdrthdrthdrthdrthdrthdrthdrthdrthdrthdrthdrthdrt dhrt hdrthdrthdrthdrh 5hsr5d r5hdr5h drthr t hdrt hkl"
)]
1
As you can see, the output count gives me 1, but it should give 38. If I do println(dataArray.count) it gives me output 38. How come? What is wrong?