1

How can I access value from pointer inside pointer on query with Parse in swift?

This has to do with three classes in Parse. One is called Post_Story, on is Post and one is User. When I query for Post_Story i am able to retreive pointer info from a key "Post", but is there any way to access information from a pointer within that pointer? (key "createdBy" to User class)

My code looks like this:

       let postQuery = PFQuery(className: "Post_Story")
    postQuery.whereKey("story", containedIn: storyObjects)
    postQuery.includeKey("post")

    postQuery.findObjectsInBackgroundWithBlock { (objects:[PFObject]?, error:NSError?) in
        if error == nil {
            for object in objects! {
                if let postL = object["post"] as? PFObject {

                    if postL["createdBy"] != nil {

                        //this is where I want to get infor from PFUser, but not all info is sent
                        print((postL["createdBy"] as! PFUser)) //prints PFUser object without username etc.

                    }
                }
            }
        }
        else {}
    }

I hope the question is not too stupid...

1 Answer 1

2

You can add postQuery.includeKey("post.createdBy") to include the user object in the createdBy column of post.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.