Milylitre
Milylitre

Reputation: 21

PFObject not being updated on IOS device

I have a project that should update a PFObject on Parse.com. It works fine on an IOS simulator, but when I downloaded it onto a phone, the inputs aren't updating in Parse. I've checked that the ID and ClientKey from Parse are still correct, and there are no errors in my code. Does anyone know what is going on?

Upvotes: 0

Views: 105

Answers (1)

Jack
Jack

Reputation: 189

Are you making sure to use the .saveInBackgroundWithBlock { (success, error) ... block to save the values in the background when you have processed the information in your app that you want to be saved into your Parse database?

For example,

A following function for a standard social media app would have the following.

    func follow(user: PFUser!, completionHandler:(error: NSError?) -> ())
{
    // Storing the relation between current user and another user and then saving it in the database under the relationKey "following"
    var relation = PFUser.currentUser().relationForKey("following")
    relation.addObject(user)
    PFUser.currentUser().saveInBackgroundWithBlock { (success, error) -> Void in

        // we now have an error option for the signUp function second loop for the user following themself
        completionHandler(error: error)            
    }
}

Upvotes: 1

Related Questions