Get PFUser object custom values

2k Views Asked by At

I have custom value in a PFUser column called "website". I am trying to get this value using the code below but it does not seem to change on the device if I update the value from Parse.com on their website using the data viewer. It also does not update across devices. Any Ideas?

websiteField.text = currentUser.objectForKey("website") as String

1

There are 1 best solutions below

1
On

I have managed to get it working with the code below.

var currentUser = PFUser.currentUser()
    currentUser.refreshInBackgroundWithBlock { (object, error) -> Void in
        println("Refreshed")
        currentUser.fetchIfNeededInBackgroundWithBlock { (result, error) -> Void in

            self.websiteStr = currentUser.objectForKey("website") as String
            self.websiteField.text = self.websiteStr

            println("Updated")

            println(self.websiteStr)
        }
    }