Search code examples
objective-ccocoansxmlelement

NSXMLNode variable name not found


Strange error here.... For this piece of code:

NSXMLNode *root = [[ads_user_defined_manufacturer_model objectAtIndex:i] parent];
NSXMLNode *make = [root childAtIndex:0];

First line returns an error "Unused variable root", second line returns an error "'root' was not declared in this scope..

Any ideas? Thanks.


Solution

  • Actually it wasn't, you're right. It was way up in the code.. I had an if statement previous to the code above without any { } . Therefore only the first statement was being done in the if statement, with the other being done outside.

    Hence the inability to see the variable decleration.

    @gaige If you want to put your response as an answer, I'd be happy to mark it as the answer. Thanks.