1

So I load my custom object from a web service and am trying to store the properties as NSStrings but keep running into this error:

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

I enabled zombies, but that's not really showing me a solution.

My properties are defined as:

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

Then I create an instance of my object and call the webservice

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

And finally, inside 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);
    }
}];

Now whenever I try to access list.ID or some other property I get the "deallocated instance" error. Any thoughts as to why I'm getting this error?

rnystrom
  • 1,906
  • 2
  • 21
  • 47

1 Answers1

3

Your ID property should be strong as well.

omz
  • 53,243
  • 5
  • 129
  • 141