2012-07-21 77 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

相關問題