1

I'm trying to fill a dictionary with values from restkit. I save the dictionary using NSUserDefaults in my restEngine.m

 NSDictionary *dict = [mappingResult dictionary];

                   [[NSUserDefaults standardUserDefaults] setObject:[NSKeyedArchiver archivedDataWithRootObject:dict] forKey:kPopulateTableView ];
                   [[NSUserDefaults standardUserDefaults] synchronize];

When I build the app, it breaks with the error message:

"[myclass encodeWithCoder:]: unrecognized selector sent to instance"

What am I doing wrong here?

1 Answer 1

5

it seems that in your NSDictionary dict you save objects that are not encodable.
BUT
Only encodable objects can be used with an archiver.

To be encodable they must implement the NSCoding protocol

SO: myclass needs to implement NSCoding


For further info read the "Archives and Serializations Programming Guide"

Sign up to request clarification or add additional context in comments.

2 Comments

So where should I implement my class using NSCoding? In my rest engine or where the class is actually defined? Sorry Im not familiar with NSCoding
in your class.. it is a protocol that defines 2? methods that you HAVE to provide then

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.