簡體   English   中英

xcode 7不在模擬器中的解析表視圖中顯示數據,但在設備中工作

[英]xcode 7 not displaying data in parse table view in simulator, but works in device

我正在使用Parse的表視圖類,我有自定義單元格用於表視圖,在Xcode 6.3.2中一切正常。 我剛剛將我的Xcode更新為7 beta,因為我想在我的設備上運行測試,而不需要為開發者帳戶支付100美元,無論如何,解析表視圖沒有在表視圖中顯示數據: 表視圖的屏幕截圖

實際上,當我嘗試將查詢結果打印到控制台時,我確實得到了我的結果。 這是我為此視圖啟用的控制器代碼:

import UIKit
import Parse
import ParseUI

class MeetsTableViewController: 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 = "Meets";
    self.pullToRefreshEnabled = true;
    self.textKey="city";
    self.paginationEnabled = false;

}

// Define the query that will provide the data for the table view
override func  queryForTable() -> PFQuery {
    let query = PFQuery(className: "Meets");
    query.orderByDescending("numberOfComming");
    return query;
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject?) -> PFTableViewCell {

    var cell = tableView.dequeueReusableCellWithIdentifier("MyCell") as! CarTableViewCell!;

    if cell == nil {
        cell = CarTableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "MyCell");
    }
    if let cityName = object?["city"] as? String{
        cell?.meetName?.text = "מפגש ב\(cityName)";
    }
    if let address = object?["address"] as? String{
        cell?.meetAddress?.text = address;
    }
    if let date = object?["date"] as? String{
        cell?.meetDate?.text = date;
    }
    if let time = object?["time"] as? String{
        cell?.meetTime?.text = time;
    }
    if let people = object?["numberOfComming"] as? Int{
        cell?.peopleAttending?.text = "\(people)";
    }
    print(object); // console is printing query results successfully

    if let thumbnail = object?["meetImg"] as? PFFile {

        thumbnail.getDataInBackgroundWithBlock{
            (imageData, error) -> Void in
            if error == nil {
                let image = UIImage(data: imageData!)
                cell.meetImage.image = image
            }}
    }

    return cell;
}

}

UPDATE
我只是試圖在我的設備中運行應用程序,並且表格正常運行,只是模擬器沒有顯示數據。

如果數據正在您的設備而不是模擬器上加載,則可能是不模擬位置的問題,這可能會阻止您的查詢從拉取結果填充表格視圖。

如果是這種情況,您可以通過以下選項模擬位置:
1)Xcode - > Debug - > Simulate Location(見下面的截圖)選擇一個城市或將GPX文件添加到項目中。
2)模擬器 - >調試 - >位置(見下面的截圖)。
3)您還可以通過模擬器上的地圖設置您的位置(請參閱: http//apple.co/1JtnYIv )。

在此輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM