更新到iOS 10后,每当我尝试更新解析heroku服务器上的PFObject时,我总是会发现此对象未找到错误。我一直在研究并尝试了许多人建议开启功能上的钥匙串共享。但是,仍然没有工作的迹象。
我使用的一些代码:
let publishQuery = PFQuery(className: "allPosts")
publishQuery.whereKey("objectId", equalTo: objectIdToPublish)
publishQuery.findObjectsInBackground { (objects, error) -> Void in
if let objects = objects {
for object in objects {
publishQuery.getObjectInBackground(withId: object.objectId!, block: { (objectToPublish, error) -> Void in
if error == nil {
let postAcl = PFACL(user: PFUser.current()!)
postAcl.getPublicReadAccess = true
postAcl.getPublicWriteAccess = true
objectToPublish!.acl = postAcl
objectToPublish!["isItPublished"] = true
objectToPublish?.saveInBackground(block: { (success, error) -> Void in
if error == nil {
self.publishedOrNot[((cellIndexPath as NSIndexPath?)?.row)!] = true
self.myTableView.reloadData()
} else {
self.displayAlert("Sth's wrong", message: "Please try again")
print(error)
}
})
}
})
}
}
}
这是我在日志中打印的错误:
2016-10-22 19:10:39.740 Pufff[609:9898] [Error]: Object not found. (Code: 101, Version: 1.13.0)
Optional(Error Domain=Parse Code=101 "Object not found." UserInfo={code=101,
error=Object not found., temporary=0, NSLocalizedDescription=Object not found.})