处理json响应时,出现以下错误:


  ***由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[DADGList setDescription:]:
  无法识别的选择器已发送到实例0x7ae88880'


它崩溃的类:

@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;
}


以及listFromDictonary过去的字典:

最佳答案

您应该将description属性重命名为其他属性,因为这是iOS回声系统中已经存在的一个字段(如果我没有记错的话,该对象为NSObject),并且会产生各种奇怪的崩溃。

10-04 10:14