简体   繁体   English

Parse.com查询未加载

[英]Parse.com Query Not Loading

I'm creating an app with displays parse data in a table view. 我正在创建一个在表视图中显示解析数据的应用程序。 I downloaded a template from https://github.com/Bizzi-Body/HowToDisplayImagesInTableViewFromParse it all worked fine when I ran it but when I put my Parse app id in and Client id it just shows a loading screen (see Screenshot) 我从https://github.com/Bizzi-Body/HowToDisplayImagesInTableViewFromParse下载了一个模板,当我运行它时一切正常,但是当我将Parse应用程序ID和Client ID放进去时,它仅显示一个加载屏幕(请参见截图)

So I thought it might be a problem with the app template so downloaded a different one and edited it, but the same problem happen, so I'm think its something wrong with my parse account settings. 因此,我认为应用模板可能有问题,因此下载了另一个模板并进行了编辑,但同样的问题也发生了,因此我认为我的解析帐户设置有问题。

截图

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
    }


}

If you enabled Parse LocalDatastore a quite similar issue is here: 如果启用了Parse LocalDatastore,则此处存在一个非常类似的问题:

https://github.com/ParsePlatform/ParseUI-iOS/issues/26 https://github.com/ParsePlatform/ParseUI-iOS/issues/26

So try to disable LocalDatastore or update ParseSDK 因此,请尝试禁用LocalDatastore或更新ParseSDK

I think the problem is that the Custom Cell class name does not match the Custom Cell Class detailed in the story board. 我认为问题在于自定义单元类名称与故事板上详细描述的自定义单元类不匹配。

If your custom cell class is called "CustomCell" (ie - in "CustomCell.swift") you need to make sure that in the story board the custom class setting for the prototype cell is also "CustomCell". 如果您的自定义单元类称为“ CustomCell”(即-在“ CustomCell.swift”中),则需要确保在故事板上,原型单元的自定义类设置也为“ CustomCell”。

Maybe this changed when you created your one custom class/cell 当您创建一个自定义类/单元时,这种情况可能会有所改变

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM