I want to store an NSDateComponents to NSUserDefaults, so need to wrap it in an NSData first, how can this be done?
Alternatively is there another way of storing an NSDateComponent to user defaults?
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.
NSDateComponentsconforms toNSCodingprotocol, so you can useNSKeyedArchiver/NSKeyedUnarchiverto do the job. Here is some sample code: