我刚刚将我的Xcode更新为7 beta,因为我想在我的设备上运行测试,而不需要为开发者帐户支付100美元,无论如何,解析表视图没有在表视图中显示数据:
实际上,当我尝试将查询结果打印到控制台时,我确实得到了我的结果.
这是我为此视图启用的控制器代码:
import UIKitimport Parseimport ParseUIclass MeetstableVIEwController: PFquerytableVIEwController {// Initialise the PFquerytable tablevIEwoverrIDe 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 vIEwoverrIDe 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不在模拟器中的解析表视图中显示数据,但在设备中工作所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)