Ben Sullivan
Ben Sullivan

Reputation: 2154

Using Parse user queries in Swift

I am making a Swift iOS app using Parse.

An existing user needs to be able to enter their email address (which will be their username) and then the updatedAt information will be displayed.

How do setup the PFUser.Query() to create a variable to store the relevant updatedAt information.

Basically I want to say: If entered email address equals existing email address then display the updatedAt information.

Thank you!

Upvotes: 1

Views: 1186

Answers (1)

Aaron
Aaron

Reputation: 6704

// First get user's inputted email
let enteredEmailAddress = "[email protected]"

// Then query and compare
var query = PFQuery(className: "_User")
query.whereKey("email", equalTo: enteredEmailAddress)
query.findObjectsInBackgroundWithBlock { (objects: [AnyObject]!, error: NSError!) -> Void in
    if error == nil {
        println(objects[0].updatedAt)
    }
}

Upvotes: 2

Related Questions