I have made a query in parse and fetched an array of GeoPoint coordinates. This was done inside a closure. I can only access the array values inside that closure. I need to be able to use those value so they can be used as annotations on a map but I can't get to them. Can somebody tell me how to get the array values out of the closure.
code:
var user = PFUser.currentUser()
user["location"] = geopoint
var query = PFUser.query()
query.whereKey("location", nearGeoPoint:geopoint)
query.limit = 10
query.findObjectsInBackgroundWithBlock({ (objects: [AnyObject]!, error: NSError!) -> Void in
for object in objects {
var user:PFUser = object as PFUser
var otherUsersCoord = [PFGeoPoint]()
otherUsersCoord.append(user["location"] as PFGeoPoint)
println("The other users coords are: (otherUsersCoord)")
}
})}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…