0

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

LiTHiUM2525
  • 297
  • 3
  • 6
  • 19
Tom Coomer
  • 6,227
  • 12
  • 45
  • 82
  • 2
    Have you refreshed the `currentUser` object since updating it on their website? You'll need to manually do that. – rickerbh Dec 05 '14 at 04:18

1 Answers1

3

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)
        }
    }
Tom Coomer
  • 6,227
  • 12
  • 45
  • 82