Hello,
I am new to objective-c and iphone programming and I have ran into the following problem with TouchXML. The value is successfully parsed and no exception is thrown within callService method, but it throws EXC_BAD_ACCESS error anyways.
If I comment out the last line [nodes release] it has no error in that case, but I am worrying about the memory leaking.
Code:
-(IBAction) callService:(id)sender
{
NSURL *url = [NSURL URLWithString:@"http://someurl.com/api/getbyid/40"];
NSData *XMLData = [NSData dataWithContentsOfURL:url];
CXMLDocument *doc = [[[CXMLDocument alloc] initWithData:XMLData options:0 error:nil] autorelease];
NSArray *nodes = NULL;
nodes = [doc nodesForXPath:@"//StoreDetails" error:nil];
for (CXMLElement *node in nodes) {
txtOutput.text = [[node nodeForXPath:@"Name" error:nil] stringValue];
}
[nodes release];
}