Ios “ObjectId:New”导致值为零
我正在从Parse中检索数据,并试图获取Post的ObjectId。我可以从Parse fine中提取数据,但是当我尝试将数据赋给变量时,objectId突然读取objectId:New 这导致我的应用程序崩溃!这个错误是什么 注意:读数来自两个不同的岗位,但错误是相同的。从解析中检索数据时显示,分配数据时新建 检索post对象的代码: } 我用于尝试分配ObjectId字符串的代码:Ios “ObjectId:New”导致值为零,ios,swift,parse-platform,Ios,Swift,Parse Platform,我正在从Parse中检索数据,并试图获取Post的ObjectId。我可以从Parse fine中提取数据,但是当我尝试将数据赋给变量时,objectId突然读取objectId:New 这导致我的应用程序崩溃!这个错误是什么 注意:读数来自两个不同的岗位,但错误是相同的。从解析中检索数据时显示,分配数据时新建 检索post对象的代码: } 我用于尝试分配ObjectId字符串的代码: func setPost(){ ... self.objectId = self["
func setPost(){
...
self.objectId = self["objectId"] as? String
...
post.setPost()
print("OUTER the objectId is \(post.objectId)")
打印读数为零您在哪里创建post对象?您尚未显示该代码。此外,您通常不需要在解析中使用objectid。如果您有一个指针列类型,您可以只分配一个pfobject的实例。感谢回复,添加了一些代码。我最终可能会那样做。
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("postCell") as! ClassPostTableViewCell
let post = timelineComponent.content[indexPath.row]
post.setPost()
cell.post = post
//cell.delegate = self
return cell
}
func setPost(){
...
self.objectId = self["objectId"] as? String
...
post.setPost()
print("OUTER the objectId is \(post.objectId)")