-(void)parser:(NSXMLParser *)parser didStartElement:(NSString
*)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary
*)attributeDict {
NSLog(@"%@", elementName); // returns the current element name
if (elementName == @"group") { // never called
NSLog(@"%@", elementName);
self.group = [[Group alloc] init];
}
...
}
What exactly is going on here? The NSLog() outside the if is getting called and returning exactly the elementName I need to make the if statement true, but the NSLog() within the if statement is never called? What gives?
You don’t compare nsstrings with
==,try
if([elementName isEqualToString:@"group"])