1

I have one costum object which has a reference to another custom object. How do I encode the custom object within the one custom object in my - (void)encodeWithCoder:(NSCoder *)encoder method?

Lets say name is a string an cObj is another custom obj:

- (void)encodeWithCoder:(NSCoder *)encoder {
   [encoder encodeObject:self.name forKey:@"name"];
   [encoder encodeObject:self.cObj forKey:@"cObj"];
   }

Does this will call - (void)encodeWithCoder:(NSCoder *)encoder in my other custom object?

Thank you.

1 Answer 1

1

cObj needs to support <NSCoding>, so yes.

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.