1

I have a pointer named "Parent" in my class, "ComparablePhotos", which points to another class, "NewLog". I am trying to get the data (Address, ObjectId, Lat) from the row in NewLog that Parent points to. How do I do this using query1.includeKey provided?

Code:

    var query1 = PFQuery(className: "ComparablePhotos")
    query1.includeKey("Parent")
    //get NewLog[address], NewLog[lat], and NewLog[objectId] using "Parent" pointer

ComparablePhotos class: enter image description here

NewLog class:
enter image description here

1 Answer 1

2

see if this helps you out at all...you probably will have to change some of the objects to exactly fit your words from the parse database.hopefully that will steer you in the right direction

var query1 = PFQuery(className:"NewLog")
query1.includeKey("Parent")
query1.findObjectsInBackgroundWithBlock { (objects, error) -> Void in


    if let objects = objects {

      for object in objects {

      var address = object["address"]  as! String
      var lat =  object["lat"]  as! String
      var objectId = object["objectId"] as! String  

this is how i query a role, which is similar to a pointer query...

var roleQuery = PFRole.query()
roleQuery!.whereKey("name", equalTo: "admin")
roleQuery!.getFirstObjectInBackgroundWithBlock() { (roleObject: PFObject?, error) -> Void in

  var adminRole = roleObject as! PFRole

  adminRole.users.query()!.findObjectsInBackgroundWithBlock({ (users, error:NSError?) -> Void in

    if error == nil {

    if let adminUsers = (users as? [PFUser])  {
Sign up to request clarification or add additional context in comments.

6 Comments

I tried your first code and it returned nil... Not returning anything from the NewLog class.
i edited it so that it will query your NewLog class, you will make two separate queries for each class.. so do this exact same code for your comparable photos class.
Thank you... I am still confused unfortunately, I am new to Swift :/
did you figure it out?
|

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.