NSArray *arrAllAttributes = [[NSArray alloc]init];
arrAllAttributes = [app mtdAllCountry];
[arrAllAttributes retain];
for(int i = 0; i<[arrAllAttributes count]; i++)
{
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];
}
最佳答案
更改这些行:
NSArray *arrAllAttributes = [[NSArray alloc]init];
arrAllAttributes = [app mtdAllCountry];
[arrAllAttributes retain];
对此:
NSArray *arrAllAttributes = [[app mtdAllCountry] retain];
关于iphone - 内存泄漏问题。仪器在第 2 行显示错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5538628/