I'm using an NSXMLParser
to grab data and build an array of dictionaries with some information on a set of photos. Whenever I attempt to add a dictionary to the array, the value is always (null)
Code:
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict {
if([elementName isEqualToString:@"photoset"]) {
NSMutableDictionary *curInfo = [[NSMutableDictionary alloc] init];
[curInfo setValue:[attributeDict objectForKey:@"primary"] forKey:@"thumb-id"];
[setData insertObject:curInfo atIndex:parsedItems];
[curInfo release];
parsedItems++;
}
}
When I create curInfo
and set the object for the thumb-id
key and NSLog()
it, I get the expected result. However, when I add that dictionary to the array, then NSLog()
that index of the array, it returns (null)
Why would adding a simple object to an array not work? What am I missing?