[英]Parse.com Query Not Loading
我正在創建一個在表視圖中顯示解析數據的應用程序。 我從https://github.com/Bizzi-Body/HowToDisplayImagesInTableViewFromParse下載了一個模板,當我運行它時一切正常,但是當我將Parse應用程序ID和Client ID放進去時,它僅顯示一個加載屏幕(請參見截圖)
因此,我認為應用模板可能有問題,因此下載了另一個模板並進行了編輯,但同樣的問題也發生了,因此我認為我的解析帳戶設置有問題。
import UIKit
class TableViewController: PFQueryTableViewController {
// Initialise the PFQueryTable tableview
override init!(style: UITableViewStyle, className: String!) {
super.init(style: style, className: className)
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
// Configure the PFQueryTableView
self.parseClassName = "Photo"
self.textKey = "updatedAt"
self.pullToRefreshEnabled = true
self.paginationEnabled = false
}
// Define the query that will provide the data for the table view
override func queryForTable() -> PFQuery! {
var query = PFQuery(className: "Photo")
query.orderByAscending("updatedAt")
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("Cell") as CustomCell!
if cell == nil {
cell = CustomCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
}
// Extract values from the PFObject to display in the table cell
cell.username.text = object["user"] as String!
cell.itemdetail.text = object["description"] as String!
cell.price.text = object["Price"] as String!
var thumbnail = object["Image"] as PFFile
var initialThumbnail = UIImage(named: "question")
cell.productimage.image = initialThumbnail
cell.productimage.file = thumbnail
cell.productimage.loadInBackground()
return cell
}
}
如果啟用了Parse LocalDatastore,則此處存在一個非常類似的問題:
https://github.com/ParsePlatform/ParseUI-iOS/issues/26
因此,請嘗試禁用LocalDatastore或更新ParseSDK
我認為問題在於自定義單元類名稱與故事板上詳細描述的自定義單元類不匹配。
如果您的自定義單元類稱為“ CustomCell”(即-在“ CustomCell.swift”中),則需要確保在故事板上,原型單元的自定義類設置也為“ CustomCell”。
當您創建一個自定義類/單元時,這種情況可能會有所改變
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.