How to encode a UIImage in an `NSCoder`
问题 I have a 'User' object that contains a property of 'UIImage' class. How do I encode the image together with the other properties and save it in NSUserDefaults ? My understanding is that I can only encode NSString s? For example, currently in my code, I am adding the avatar_url (string) in the encode/decode implementation. How can I convert the url to UIImage and then encode it? - (void)encodeWithCoder:(NSCoder *)encoder { [encoder encodeObject:self.uid forKey:@"uid"]; [encoder encodeObject