-(void)loadMakes:(NSString *)strValue
{
NSDictionary *makeJSON = [strValue JSONValue];
NSDictionary *makes = NULL;
NSDictionary *car = NULL;
NSArray *keys = NULL;
NSMutableArray *tempCar = [[NSMutableArray alloc]init];
if ([makeJSON count] != 0)
{
makes = [makeJSON objectForKey:@"makes"];
keys=[[makes allKeys]sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
for(int i=0; i<[makes count]; i++)
{
car = [makes objectForKey:[keys objectAtIndex:i]];
CarMake *carMakeObj = [[CarMake alloc]init];
[carMakeObj setCarName:[car objectForKey:@"name"]];
[carMakeObj setCarLinks:[car objectForKey:@"link"]];
//[carMakeObj Print];
[tempCar addObject:carMakeObj];
[carMakeObj release];
}
self.carNamesArrayList=tempCar;
[tempCar release];
}
NSLog(@"count %d",[carNamesArrayList count]);
}
I called the above code in -viewDidAppear and it's not showing any leaks when the view is appear at first time. But when i press BACK button and again click the view, then the instrument showing leaks at
NSDictionary *makeJSON=[strValue JSONValue];
Then i added
[makeJSON release];
makeJSON = nil;
but i got error like
****-[CFDictionary release]: message sent to deallocated instance
Then i added like
NSDictionary *makeJSON=[[strValue JSONValue]retain];
again i got error like this
****-[CFDictionary release]: message sent to deallocated instance
moreover,i print the **retain count of makeJSON, it shows 2
Need help!!!!! and please say where i going wrong