0
votes

When processing a json response I a get the below error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DADGList setDescription:]: unrecognized selector sent to instance 0x7ae88880'

The class it crashed on:

@implementation DADGList

-(id)copy
{
    DADGList *list = [[DADGList alloc] init];
    list.identifier = self.identifier;
    list.name = [self.name copy];
    list.description = [self.description copy];
    list.created = [self.created copy];
    list.itemCount = self.itemCount;
    list.shareLink = [self.shareLink copy];

    return list;
}

+(DADGList *)listFromDictonary:(NSDictionary *)dictonary
{
    DADGList *list = [[DADGList alloc] init];
    NSLog( @"%@", dictonary );
    list.identifier = [[dictonary objectForKey:@"list_id"] integerValue];
    list.itemCount = [[dictonary objectForKey:@"list_items_count"] integerValue];
    list.name = [NSString stringWithString:[dictonary objectForKey:@"list_name"]];
    list.description = [NSString stringWithString:[dictonary objectForKey:@"list_description"]];
    list.created = [[NSDate alloc] initWithTimeIntervalSince1970:[[dictonary objectForKey:@"list_created"] doubleValue]];
    list.shareLink = [NSString stringWithString:[dictonary objectForKey:@"list_share_url"]];

    return list;
}

and the dictonary that is past to listFromDictonary:

2

2 Answers

2
votes

You should rename your description property for something else as this is a field already existing in the iOS echosystem (NSObject if I am not mistaken) and that creates all sort of weird crash like this.

0
votes

If you are using core data maybe you need to implement the following instance:

Mall(entity: NSEntityDescription.entity(forEntityName: "Mall", in: context)!, insertInto: nil)

Where Mall is my entity and context is my view context.