Hi all, i have encountered a problem when wanting to pass a NSMutableArray from the delegate to a tableview controller and then reload it's data, I need to do this because i have my socket in the delegate and when it receives data it returns a NSMutableArray which is supposed to be the data for the tableview, unfortunately it passes nil :( ill show you my code :D
DELEGATE:
I have synthesized the tableviewcontroller in order to use get-set
@property(nonatomic, retain) DownloadsController *downloads_Controller;
And now for the code:
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{
if([elementName isEqualToString:@"downloads"] || [elementName isEqualToString:@"results"]){
if([elementName isEqualToString:@"downloads"]){
NSLog(@"downloads found... reloading table");
downloads_Controller.downloads= xmlArray;
NSLog(@"%@ passed from %@", self.downloads_Controller.downloads, xmlArray); // <-- first value return nil, while xmlArray displays properly
[downloads_Controller.tableView reloadData];
}
}
}
DOWNLOADS CONTROLLER:
Here i have done the same as on top, in order to use get-set
@property(nonatomic, retain) NSMutableArray *downloads;
Unfortunately this is what happens... when the parser delegate gets called in AppDelegate:
2010-01-06 13:43:41.770 iMule[613:20b] downloads found... reloading table
2010-01-06 13:43:41.772 iMule[613:20b] (null) passed from ( <-- FIRST ARGUMENT NULL :(
{
name = joe;
type = text;
},
{
name = joe2;
type = text;
}
)
Anyone got any suggestions???
Thanks =D