Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios “ObjectId:New”导致值为零_Ios_Swift_Parse Platform - Fatal编程技术网

Ios “ObjectId:New”导致值为零

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["

我正在从Parse中检索数据,并试图获取Post的ObjectId。我可以从Parse fine中提取数据,但是当我尝试将数据赋给变量时,objectId突然读取objectId:New

这导致我的应用程序崩溃!这个错误是什么

注意:读数来自两个不同的岗位,但错误是相同的。从解析中检索数据时显示,分配数据时新建

检索post对象的代码:

}

我用于尝试分配ObjectId字符串的代码:

    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)")