0

I am trying to get the objects that are relational to a class.

Bellow is my query:

var user = PFUser.currentUser()
println("PERSON\(user)")
var relation = user!.relationForKey("followingThings")
var queryTeste = relation.query()
queryTeste?.findObjectsInBackgroundWithBlock({ (object: [AnyObject]?, error: NSError?) -> Void in
    println("OBJECTS FROM RELATIONAL QUERY\(object)")
})

If you look at the output I am able to retrieve my relational objects, BUT... I get an error just before retrieving them.

I've tried different combinations in order to get rid of it but no success. Also most of the questions here are on objective C and sintaxe and methods differ a bit.

Any ideas about what could be causing the error?

PERSONOptional( { email = "[email protected]"; emailVerified = 1; followingThings = " Things>"; points = 10; username = Me; })

2015-08-31 19:16:32.161 App[30479:9376080] [Error]: field followingThings cannot be included because it is not a pointer to another object (Code: 102, Version: 1.8.0)

OBJECTS FROM RELATIONAL QUERYOptional([

Things: 0x7ff031a736c0, objectId: G29f9Wfqj5, localId: (null)> { description = Camping; searchKey = camping; usersFollowing = " _User>"; },

Things: 0x7ff031a76520, objectId: IPEg4G2Qec, localId: (null)> { description = "Animal Care"; searchKey = "animal care"; usersFollowing = " _User>"; },

Things: 0x7ff031a76120, objectId: Jg4oRjebKE, localId: (null)> { description = Bicycling; searchKey = bycicling; usersFollowing = " _User>"; },

Things: 0x7ff031a75810, objectId: TseQvlo6AL, localId: (null)> { description = Boating; searchKey = boating; usersFollowing = " _User>"; }])

1 Answer 1

1

works for me like that

    var relation = currentUser.relationForKey("product")
                        relation.query()?.findObjectsInBackgroundWithBlock({

                            (let productResult, let error) -> Void in
                            //println("result:\(productResult!.count)")

                            if let result = productResult {
                                //println(result.count)
                                for product in result {
println(product)
}
}
}
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.