[英]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.