2

I need to save an object into Parse with pointer to User table.

At first I try to get PFUser object by objectId

var query = PFUser.query()
var user = query.getUserObjectWithId(a.id)

or try that

var user = PFUser.getUserObjectWithId(a.id)

and got the mistake "does not have a member getUserObjectWithId"

Parse API:

+ (PFUser *)getUserObjectWithId:(NSString *)objectId

And one more question. Is there a simple way to put the pointer to User table without an additional query?

I've try to save earlier PFUser object from query

var query = PFUser.query()
query.whereKey("email", equalTo:friendMail)
var friend = query.findObjects()

but the result of query is not PFUser.

hodov
  • 69
  • 3
  • 7

2 Answers2

1

The answer at the second question:

The object could be saved as PFUser as

friend = object as? PFUser
hodov
  • 69
  • 3
  • 7
0

I just went through this issue for myself. Try this:

var user = PFQuery.getUserObjectWithId(a.id)!

In my own project, I was able to use the following successfully:

let sampleId:String = "abcXYZ"
let sampleUser:PFUser = PFQuery.getUserObjectWithId(sampleId)!
blwinters
  • 1,911
  • 19
  • 40