Save singleton object to disk - native Iphone app
Question
I'm having some troubles trying to save a singleton object to the iPhone disk.
The object is a collection of 2 arrays, which contain the faved posts and faced jobs.
Basically --> Favorites = arrayOfFavedPosts + arrayOfFavedJobs
Now I am trying to save the Favorites
object, so that the once faved posts or jobs can be read from the disk.
Error:
2012-04-26 14:56:56.957 FirstDesign_test2[666:10403] -[Post encodeWithCoder:]: unrecognized selector sent to instance 0x6c74a80
This error fires up when I call the saveToDisk
method when I add a new object to one of the arrays...
Some help would be really appreciated!
Thanks in Advance
Solution
You need to adopt and implement the NSCoding
protocol on your Post
class (and presumably on your Job
class).
NSCoding Protocol Reference
Archives and Serializations Programming Guide: Encoding and Decoding Objects
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow