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];
}
4

1 回答 1

4

更改这些行:

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

对此:

NSArray *arrAllAttributes = [[app mtdAllCountry] retain];
于 2011-04-04T12:46:07.603 回答