嗨,大家好,我試圖打印我的查詢其在香港專業教育學院創建解析,在這裏它是 能正常工作和做什麼,我需要它查詢解析,如何在Swift中的tableView單元格中打印數據?
//store my currentLocations here
var locations : [PFObject] = []
PFGeoPoint.geoPointForCurrentLocationInBackground { (geoPoint:
PFGeoPoint?, error: NSError?) -> Void in
if geoPoint != nil {
var geoPointLon = geoPoint?.longitude
var geoPonitLan = geoPoint?.latitude
var currentLocation = PFGeoPoint(latitude: geoPonitLan!, longitude: geoPointLon!)
var query = PFQuery(className: "User")
query.whereKey("currentLocation", nearGeoPoint: currentLocation, withinKilometers: 5.0)
query.findObjectsInBackgroundWithBlock({ (objects: [AnyObject]?, error: NSError?) -> Void in
if let myObject = objects as? [PFObject] {
for objects in myObject {
self.locations.append(objects)
}
}
self.tableView.reloadData()
})
}
}
這是我的tableview細胞和行
數func tableView(tableView: UITableView, numberOfRowsInSection section:
Int) -> Int {
return self.locations.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = UITableViewCell()
cell.textLabel?.text = "test"
return cell
}
當運行我的應用程序「測試」確實打印正確的條目數,所以我知道我的查詢正在工作。
我的問題是如何打印我的課堂「用戶」,在Parse內名爲「currentLocation」的列的實際位置?
如果您需要任何其他信息只是讓我知道感謝
您正在錯誤地創建您的單元格。 –
嘿,yep我知道,這是一個測試單元打印查詢的數量,需要正確的版本顯示什麼數據庫 –