I'm trying to access the "objectId" field in "User" table, while running a query on a "Photos" table.
Here is the Parse.com query (simplified) run on "Photos" table:
func checkDbForNewPhotos() {
var query = PFQuery(className:"Photos")
query.whereKey("fbId", equalTo:"34343434343434")
query.includeKey("user.objectId"); // Is this what is needed to access user info ?
query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]!, error: NSError!) -> Void in
if error == nil {
for object in objects {
println(object) // See sample object below
println(user.objectId) // Error here: user type doesn't have member objectId
}
println(object): Here is a sample object returned from the query. I'm trying to access 9wEGRWSnTk from the "user" field which is a pointer to another table.
<Photos: 0x7c091fd0, objectId: 6D0aHreHsC, localId: (null)> {
alerts = 0;
country1 = france;
country2 = "";
imageFile = "<PFFile: 0x7b7d9130>";
user = "<PFUser: 0x7b7d95f0, objectId: 9wEGRWSnTk>";
}
How should I format that in swift to access 9wEGRWSnTk ?
println(object.user)