Memory leak issue. Instument shows error in line 2
NSArray *arrAllAttributes = [[NSArray alloc]init];
arrAllAttributes = [app mtdAllCountry];
[arrAllAttributes retain];
for(int i = 0; i<[arrAllAttributes count]; i+开发者_如何学JAVA+)
{
NSDictionary *dictTemp1 = [[NSDictionary alloc]init];
NSString *strCountryName;
NSString *strCountryValue;
dictTemp1 = [arrAllAttributes objectAtIndex:i];
strCountryName = [dictTemp1 objectForKey:@"country"];
strCountryValue = [dictTemp1 objectForKey:@"country_ID"];
[dictTemp1 retain];
[arrCountries addObject:strCountryName];
[arrCountryValues addObject:strCountryValue];
}
Change these lines:
NSArray *arrAllAttributes = [[NSArray alloc]init];
arrAllAttributes = [app mtdAllCountry];
[arrAllAttributes retain];
To this:
NSArray *arrAllAttributes = [[app mtdAllCountry] retain];
精彩评论