-1

I'm building an app with Parse and need the ability to save the current user (PFUser) for a given post they create. Then, I need the ability to retrieve that data when other users view their posts - so they can see the person's profile picture.

What do I use here - PFObject and PFPointer? Please show code examples.

Lucas Huang
  • 3,998
  • 3
  • 20
  • 29
user2579706
  • 79
  • 1
  • 9
  • First of all, what platform are you building for? PFUser I would assume you're building fir iOS right? Secondly, READ DOCUMENTATION! This is the exactly same case study they used in their guide! https://parse.com/docs/ios/guide#objects-relational-data – Jack Song May 23 '15 at 02:41

1 Answers1

1

First of all, I think you should go to the Parse guide because they provide good documentation. That's extremely helpful. Just don't be lazy to read. By the way, Parse does not have something called PFPointers.

You can try it:

let post = PFObject(className: "Post")
post["creator"] = PFUser.currentUser()
post.saveInBackgroundWithBlock {(done: Bool, error: NSError?) in

}

let postQuery = PFQuery(className: "Post")
postQuery.whereKey("creator", equalTo: PFUser.currentUser());
postQuery.findObjectsInBackgroundWithBlock {(result: [AnyObject]?, error: NSError?) in

}
Lucas Huang
  • 3,998
  • 3
  • 20
  • 29