iOS   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – xcode 7不在模拟器中的解析表视图中显示数据,但在设备中工作大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用Parse的表视图类,我有自定义单元格用于表视图,在 Xcode 6.3.2中一切正常.
我刚刚将我的Xcode更新为7 beta,因为我想在我的设备上运行测试,而不需要为开发者帐户支付100美元,无论如何,解析表视图没有在表视图显示数据:

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

实际上,当我尝试将查询结果打印到控制台时,我确实得到了我的结果.
这是我为此视图启用的控制器代码

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 – >调试 – >通过选择其中一个城市或将GPX文件添加项目中来模拟位置(请参见下面的屏幕截图).2)模拟器 – >调试 – >位置(见下面的截图). 3)您还可以通过模拟器上的地图设置您的位置(参见: http://apple.co/1JtnYIv).

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

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

大佬总结

以上是大佬教程为你收集整理的ios – xcode 7不在模拟器中的解析表视图中显示数据,但在设备中工作全部内容,希望文章能够帮你解决ios – xcode 7不在模拟器中的解析表视图中显示数据,但在设备中工作所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。