Tom Coomer
Tom Coomer

Reputation: 6547

Parse.com Refresh User Info

I have written an iOS app that uses Parse.com. When I need to change the information about a user I use refreshInBackgroundWithBlock. I am now writing the app for Mac OS X but I do not seem to be able to use refreshInBackgroundWithBlock. Any Suggestions?

Here is the code below.

//Refresh the User Info
currentUser.refreshInBackgroundWithBlock { (object, error) -> Void in
//Fetch the User Info
currentUser.fetchIfNeededInBackgroundWithBlock { (result, error) -> Void in
    //Check if the comments read is nil
    if object.objectForKey("commentsRead") === nil {
         println("Comments Read is empty")                     
    } else {                       
         var currentRead:[Int] = []
         //If not empty assign the array to the value
         currentRead = object.objectForKey("commentsRead") as Array
         currentRead.append(0)
         var user = PFUser.currentUser()
         user.setObject(currentRead, forKey: "commentsRead")
         user.saveInBackgroundWithBlock { (result, error) -> Void in
         println("Completed!")
     }

}

Upvotes: 2

Views: 462

Answers (1)

siegy22
siegy22

Reputation: 4413

According to the parse doc, refreshInBackgroundWithBlock is deprecated and replaced by fetchInBackgroundWithBlock (See this)

So you don't need to call refreshInBackgroundWithBlock.

Upvotes: 2

Related Questions