Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
422 views
in Technique[技术] by (71.8m points)

ios - Parse Unpin Does Not Remove Object From Local Datastore

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I've contacted the support team about the problem where you can't unpin an object that has a referenced object, so I'm sharing the thread for those interested:

https://developers.facebook.com/bugs/138298746504630/

The support person said it was By Design, but upon my request to improve this specification, he told me he would tell the team about it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...