-(void)transformObjects:(NSMutableArray*)array key:(NSString*)key
{
NSMutableArray* archiveArray = [[NSMutableArray alloc]initWithCapacity:array.count];
for (Furniture *furniture in array) {
// The error occurs on the line below
NSData *furnitureEncodedObject = [NSKeyedArchiver archivedDataWithRootObject:furniture];
[archiveArray addObject:furnitureEncodedObject];
}
NSUserDefaults *userData = [NSUserDefaults standardUserDefaults];
[userData setObject:archiveArray forKey:key];
}
Error log:
2014-03-04 10:55:27.881 AppName[10641:60b] -[Furniture encodeWithCoder:]: unrecognized selector sent to instance 0x15d43350
I have no idea why do I get "unrecognized selector sent to instance" when trying to archive an object.
Furniture
class conforms to theNSCoding
protocol? – Forrester