Reputation: 6547
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