0

ObjectA has a PFPointer (lets call it pointerToB) to an ObjectB. Now if I want to create a new instance:

PFObject *newA = [PFObject objectWithClassName:@"ObjectA"];

is there any way to set pointerToB without the actual PFObject *objectB?

I'm wrapping the PFObjects into my own model classes to persist and I store the objectIds.

I'd really like to avoid making a call to Parse to retrieve the objectB when I already have the objectId.

Any way of doing something like:

PFObject *newA = [PFObject objectWithClassName:@"ObjectA"];
newA[@"pointerToB"] = persistedObject.parseObjectId; // This is a string, but it identifies the actual ObjectB object in Parse.

1 Answer 1

1

You can use +PFObject.objectWithoutDataWithClassName:(NSString *)className objectId:(NSString *)objectId

That returns an object without any data but you can set it to the pointer of the object and it will work.

If you need to fetch it's data you can just call -fetch on that object.

Reference

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

1 Comment

oh wow.. I looked through the docs and just missed that completely. Was looking at PFPointer. Thanks!

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.