从JSON加载属性,得到“消息发送到解除分配的实例”

所以我加载我的自定义对象从Web服务,并试图存储属性作为NSStrings,但继续运行到这个错误:

-[CFString _cfTypeID]: message sent to deallocated instance 0x100d3d40 -[CFString retain]: message sent to deallocated instance 0x100d3d40 

我使僵尸,但这并不真正向我展示了一个解决scheme。

我的属性被定义为:

 @property (strong, nonatomic) NSString *title; @property (assign, nonatomic) NSString *ID; @property (strong, nonatomic) NSString *redLabel; @property (strong, nonatomic) NSString *greenLabel; 

然后我创build我的对象的实例,并调用Web服务

 QuickList *list = [[QuickList alloc] init]; [list loadLatestQuickList]; 

最后,在loadLatestQuickList里面…

 NSURLRequest *request = // create a GET request... [NSURLConnection sendAsynchronousRequest:request queue:notMainQueue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error){ NSError *parsingError; NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&parsingError]; if (!parsingError && [json isKindOfClass:[NSDictionary class]]) { NSDictionary *dataDictionary = [json objectForKey:@"data"]; NSDictionary *quickListDictionary = [dataDictionary objectForKey:@"QuickList"]; NSString *ID = [quickListDictionary objectForKey:@"id"]; NSString *title = [quickListDictionary objectForKey:@"name"]; NSString *redLabel = [quickListDictionary objectForKey:@"red_label"]; NSString *greenLabel = [quickListDictionary objectForKey:@"green_label"]; self.ID = ID; self.title = title; self.redLabel = redLabel; self.greenLabel = greenLabel; // tell a channel that everything is loaded } else { NSLog(@"%@",parsingError); } }]; 

现在每当我尝试访问list.ID或其他属性,我得到“解除分配的实例”错误。 任何想法,为什么我得到这个错误?

您的ID应该strong