您好,我的查询非常简单。 我基本上想要返回按用户距离排序的对象。
如果我传入PFGeoPoint,查询将不返回任何内容。没有错误。 如果我没有输入PFGeoPoint,则查询返回对象。
怎么回事? 谢谢:))
var query = PFQuery(className: "resorts")
query.whereKey("geoPoint", nearGeoPoint: loc)
query.limit = 100
query.whereKey("showMe", equalTo: true)
query.findObjectsInBackgroundWithBlock { (objects, error : NSError!) -> Void in
if error == nil
{
self.objects = objects as [PFObject]
}
} //returns nothing
var query = PFQuery(className: "resorts")
query.whereKey("geoPoint", nearGeoPoint: loc)
query.limit = 100
query.whereKey("showMe", equalTo: true)
query.findObjectsInBackgroundWithBlock { (objects, error : NSError!) -> Void in
if error == nil
{
self.objects = objects as [PFObject]
}
} //returns objects
答案 0 :(得分:0)
试试这个
var myList = [AnyObject]()
query.findObjectsInBackgroundWithBlock{(object:[AnyObject]!, error = NSError! ) -> Void in
if error == nil {
println("successful query")
for object in objects {
self.myList.append(object)
}
} else {
println(error)
}
}