2011-04-04 32 views
3
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]; 
} 
+0

儀器在該行顯示100.0%和內存泄漏。這是什麼意思? – 2011-04-04 13:55:45

回答

4

更改這些行:

NSArray *arrAllAttributes = [[NSArray alloc]init]; 
arrAllAttributes = [app mtdAllCountry]; 
[arrAllAttributes retain]; 

向該:

NSArray *arrAllAttributes = [[app mtdAllCountry] retain];