开发者

NSMutableDictionary won't be added to NSMutableArray

开发者 https://www.devze.com 2023-02-15 01:23 出处:网络
if ([elementName isEqualToString:@\"record\"]) { [records addObject:[currentDictionary mutableCopy]]; NSInteger size = [records count];
if ([elementName isEqualToString:@"record"]) {
        [records addObject:[currentDictionary mutableCopy]];
    NSInteger size = [records count];
    NSLog(@"Current array size %d",size);
  开发者_Go百科      [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().

0

精彩评论

暂无评论...
验证码 换一张
取 消