The line NSDictionary *statsdictionary = [XMLReader dictionaryForXMLString:statsdataAsString
error:&staterror];
is returning an NSArray, and not a NSDictionary, so the NSXMLParser crashes since an NSArray doesn't know any methods named object for key.
EDIT:
In your case, the last two lines needs to be changed to something like this (NB: UNTESTED!):
NSArray *statsArray = [XMLReader dictionaryForXMLString:statsdataAsString
error:&staterror];
_stCreditlabel.text = [[statsArray[0] valueForKey:@"Name"] valueForKey:@"text];
If you want to access more of the statistic
elements inside the statistics
array, you can loop them with:
for (NSDictionary *statsObject in statsArray){
}
Also, I'd recommend this tutorial on how to parse Xml in iOS: http://www.raywenderlich.com/725/xml-tutorial-for-ios-how-to-read-and-write-xml-documents-with-gdataxml.