I'm reading XML data and creating objects, but I need some of my object variables to be floats. And with the - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
it obviously becomes a string and my float variables will be set to 0.000000.
In the - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
I tried something like this when setting the value to the object, but it's apparently incompatible types as setValue wants a (id)key (and I just realized that temp was set to 0.000000 anyways, so the floatValue doesn't work either).
if([elementName isEqualToString:@"longitude"])
{
float temp = [currentElementValue floatValue];
[myObj setValue:temp forKey:elementName];
}
Does anyone have any idea how to solve it or do I just have to set it to NSStrings in my object and convert it to floats afterwards?