Consider the following code
[coder encodeObject: properties forKey:@"properties"];
Are there any restrictions on what kind of object is passed as an argument to encodeObject? Can it be an object from a custom class?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can encode any object, as long as it implements the
NSCodingprotocol (many ‘default’ classes – such asNSString,NSArray,NSDictionary,NSData, etc. – already implement this protocol, and you can encode them without problem). If you want to encode an array or dictionary of custom objects, those objects will have to implement the protocol as well.You can read more about this in the Archives and Serializations Programming Guide and the NSCoding Protocol Reference…