Segev
Segev

Reputation: 19303

Can't figure out who is calling a class

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PeopleData initWithCoder:]: unrecognized selector sent to instance 0x6888c10'

I'll try to make it simple. How does this line:

NSData* objData = [NSKeyedArchiver archivedDataWithRootObject:[newStorage yourStaticArray]];

Knows in what class to look for the NSCode? Right now I'm getting the error above because it is searching for the NSCode in the wrong place. In the class PeopleData there's nothing but properties.

Upvotes: 1

Views: 74

Answers (1)

Inder Kumar Rathore
Inder Kumar Rathore

Reputation: 39988

When you archive or unarchive an object, at that time initWithCoder or encodeWithCoder is called. Please implement NSCoding in PeopleData class

For tutorial about NSCoding. Here is the good tutorial.

Upvotes: 3

Related Questions