2012-07-21 76 views
1

所以我加载从Web服务我的自定义对象,我试图存储性能NSString的,但继续运行这个错误:加载性能,得到“消息发送到释放实例”

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

我使僵尸,但这并不真正向我显示一个解决方案。作为

我的属性定义:

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

然后创建我的对象的实例,并调用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或其他一些属性,我都可以“解除分配的实例”错误。任何想法,为什么我得到这个错误?

回答

3

您的ID物业也应该是strong

+0

我被推迟了...... – rnystrom 2012-07-22 03:47:45

相关问题