简体   繁体   中英

NSMutableDictionary won't be added to NSMutableArray

if ([elementName isEqualToString:@"record"]) {
        [records addObject:[currentDictionary mutableCopy]];
    NSInteger size = [records count];
    NSLog(@"Current array size %d",size);
        [currentDictionary release];
}

The above code won't add the NSMutableDictionary object to the NSMutableArray. The Log displays '0' as the size of the array.

Please alloc the "records" array using the code

records = [[NSMutableArray alloc] init]; 

in ViewDidLoad().

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM