views:

155

answers:

1

Using NSXMLParser

why does this line of code cause an exception:

ushort crash = [[attributeDict objectForKey:@"a"] unsignedShortValue];

The value in the xml file is "0"

if I use integerValue it works

what is happening?

+3  A: 

If you looked at the object throwing the exception, you would see it's something that doesn't have an unsignedShortValue method — I think NSString in this case.

Chuck