I am Implementing deleting post function. I use prepare segue myTableView pass PFObject(shown as object in code) to detail view which include deleting function. I try to use PFOBJECT's objectId to delete post, because this is unique and it is passed from original post when it is selected. This is my code,
@IBAction func deleteButtonTapped(sender: AnyObject) {
let query = PFObject(className:"Posts")
let tryToDeleteThisObjectId = object.objectId
query.objectId = tryToDeleteThisObjectId
query.deleteInBackground()
but when I activate my app, I get an error
'NSInternalInconsistencyException', reason: 'Attempted to change an objectId to one that's already known to the OfflineStore.' .
I understand object is passed as an offline, So I tried save objectId in tableView to pass detailView, it worked. however I don't want user use extra cellular data for this, and I want to find simpler way to solve this problem.
my questions are
How can I get objectId from PFobject without this error?
if I can't, is there alternative way to delete specific post(data row in parse)?
please provide me example code.