简体   繁体   English

xcode 7不在模拟器中的解析表视图中显示数据,但在设备中工作

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

I'm using Parse's table view class, I have my custom cell for the table view, everything worked fine in Xcode 6.3.2. 我正在使用Parse的表视图类,我有自定义单元格用于表视图,在Xcode 6.3.2中一切正常。 I just updated my Xcode to 7 beta, because I want to run tests on my device without paying 100$ for developer account, anyways, the parse table view isn't displaying the data in table view: 我刚刚将我的Xcode更新为7 beta,因为我想在我的设备上运行测试,而不需要为开发者帐户支付100美元,无论如何,解析表视图没有在表视图中显示数据: 表视图的屏幕截图

When actually when I try to print my query results to the console, I do get my results. 实际上,当我尝试将查询结果打印到控制台时,我确实得到了我的结果。 Here's my code for the controller incharged for this view: 这是我为此视图启用的控制器代码:

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 UPDATE
I just tried to run the app in my device, and the table is working like it should be, just the simulator isn't showing the data. 我只是试图在我的设备中运行应用程序,并且表格正常运行,只是模拟器没有显示数据。

If data is loading on your device and not the simulator, it could be an issue of not simulating a location, which could prevent your query from pull results to populate the table view. 如果数据正在您的设备而不是模拟器上加载,则可能是不模拟位置的问题,这可能会阻止您的查询从拉取结果填充表格视图。

If this may be the case, you can simulate a location through the following options: 如果是这种情况,您可以通过以下选项模拟位置:
1) Xcode -> Debug -> Simulate Location (see screenshot below) by selecting one of the cities or adding a GPX file to your project. 1)Xcode - > Debug - > Simulate Location(见下面的截图)选择一个城市或将GPX文件添加到项目中。
2) Simulator -> Debug -> Location (see screenshot below). 2)模拟器 - >调试 - >位置(见下面的截图)。
3) You can also set your location via Maps on Simulator (see: http://apple.co/1JtnYIv ). 3)您还可以通过模拟器上的地图设置您的位置(请参阅: http//apple.co/1JtnYIv )。

在此输入图像描述

暂无
暂无

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

相关问题 模糊视图可在模拟器中使用,但不能在设备上使用 - Blur View works in Simulator but not on device 解析不适用于应用发行版,但可以在模拟器上或通过xcode安装在设备上时使用 - Parse doesn't work in app release version, but works on simulator or when installed on device via xcode Simulator上的Xcode应用程序可以在真实设备崩溃时正常工作 - Xcode app on Simulator works, on real device crashes 无法在真实设备上解析日期,可在模拟器中使用 - Unable to parse a date on real device, works in simulator 解析数据图像显示在iOS模拟器中,但不在设备中 - Parse data image shows in iOS simulator but not in device 通过prepareForSegue传递数据只能在模拟器上使用,而不能在设备上使用 - Passing data via prepareForSegue works on simulator but NOT on device 后台方法停止在设备上运行,仅适用于模拟器swift 4 xcode 9 - Background method stops running on device , only works on simulator swift 4 xcode 9 Xcode 5和iOS 7模拟器/设备崩溃并出现僵尸错误-适用于iOS6 - Xcode 5 and iOS 7 Simulator/Device Crash with zombie error - Works on iOS6 Xcode 9 bug:在设备上构建失败并出现大量错误,模拟器运行良好 - Xcode 9 bug : build on device fails with lots of errors, simulator works well 应用程序在Simulator(Xcode 7.1.1)中运行良好,但在iOS设备上运行不正常 - app works fine in Simulator (Xcode 7.1.1) but not on iOS device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM