How can I make my own custom class serializable? I specifically want to write it to a file on iPhone, just plist and thee class is just a simple instance class, just NSStrings and maybe a NSUrl.
Share
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’ll want to implement the NSCoding protocol. Implement initWithCoder: and encodeWithCoder: and your custom class will work with NSKeyedArchiver and NSKeyedUnarchiver.
Your initWithCoder: should look like this:
and encodeWithCoder: