简体   繁体   中英

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)

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:

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

So try to disable LocalDatastore or update 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".

Maybe this changed when you created your one custom class/cell

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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