This should work.
Here is one of many attempts to get this figured out
myTrainingSessions[indexPath.row].unpinInBackgroundWithBlock{ (succ, e) -> Void in
if succ == true {
// just remove from table view etc
self.myTrainingSessions[indexPath.row].deleteEventually()
self.myTrainingSessions.removeAtIndex(indexPath.row)
self.tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
// Shows that my object is still in datastore!
// object should be UNPINNED - but appers in this result....
var query = PFQuery(className:TrainingSession.parseClassName())
query.whereKey(self.userType(), equalTo: PFUser.currentUser())
query.orderByDescending("createdAt")
query.fromLocalDatastore().ignoreACLs()
query.findObjectsInBackgroundWithBlock { (objects, error) -> Void in
if error != nil { return }
if let result = objects as? [TrainingSession] {
println("local results")
println(result)
}
}
}
}
I do a query after unpinning and the object is still there.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…