i have an UITableView and im trying to return the number of rows using [arrayName count] however when i run the application it seems to be crashing with no errors showing in console. Here is some code .. (also when i test the array in ViewDidLoad using NSLog, it does return ’16’ so im not sure why it crashes when i do the row count. Thanks ..
Share
I think the problem is in this line:
I guess the
- searchmethod returns an autoreleased object, so that yourelementsobject receives the release message after the methodviewDidLoadreturns and hence gets deallocated.You can fix this in two ways:
add a
retaincall, like thiselements = [[xpathParser search:@"//div[starts-with(@id,'content_div')]//a"] retain];use properties, like this
self.elements = [xpathParser search:@"//div[starts-with(@id,'content_div')]//a"];