我的应用程序让用户可以看到附近的人。我正在尝试使用 GeoQueries 查询以显示从最近到最远的最近用户,该应用程序获取用户当前位置并搜索存储的解析列“位置”,但我收到一条错误消息,提示“无法调用 'whereKey'” '(string, nearGeoPoint: Void)' 类型的参数列表
有人知道怎么修这个东西吗?
// Configure the PFQueryTableView
self.parseClassName = "User"
self.textKey = "fullName"
self.pullToRefreshEnabled = true
self.paginationEnabled = false
}
// Define the query that will provide the data for the table view
override func queryForTable() -> PFQuery{
let userGeoPoint = PFGeoPoint.geoPointForCurrentLocationInBackground {
(geoPoint: PFGeoPoint?, error: NSError?) -> Void in
}
var query = PFQuery(className: "User")
query.whereKey("location", nearGeoPoint:userGeoPoint)
return query
}
//override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject?) -> PFTableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("CustomCell") as! CustomCell!
if cell == nil {
cell = CustomCell(style: UITableViewCellStyle.Default, reuseIdentifier: "CustomCell")
}
// Extract values from the PFObject to display in the table cell
if let name = object?["fullName"] as? String {
cell.name.text = name
}
if let type = object?["lookingFor"] as? String {
cell.type.text = type
}
if let location = object?["location"] as? String {
cell.location.text = location
}
let cover = object?["cover"] as! PFFile
cover.getDataInBackgroundWithBlock {
(imageData: NSData?, error: NSError?) -> Void in
if error == nil {
if let imageData = imageData {
let image = UIImage(data:imageData)
}
}
}
let profile_pic = object?["profile_pic"] as! PFFile
profile_pic.getDataInBackgroundWithBlock {
(imageData: NSData?, error: NSError?) -> Void in
if error == nil {
if let imageData = imageData {
let image = UIImage(data:imageData)
}
}
}
return cell
}
}