Note that there are some explanatory texts on larger screens.

plurals
  1. POreload tableview after call to WCF service
    primarykey
    data
    text
    <p>I am calling a WCF service to display data in a UITableViewController.The code in the .m file is:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; [docTable setDataSource:self]; [docTable setDelegate:self]; } -(void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; EDViPadDocSyncService *service = [[EDViPadDocSyncService alloc]init]; EDVCategory *cat = [EDVCategory alloc]; cat.categoryId = [catId intValue]; [service getDocsByCatId:self action:@selector(getDocsByCatIdHandler:) category:cat]; [docTable reloadData]; } - (void) getDocsByCatIdHandler: (id)value { if([value isKindOfClass:[NSError class]]) { NSLog(@"%@", value); return; } if([value isKindOfClass:[SoapFault class]]) { NSLog(@"%@", value); return; } NSMutableArray* result = (NSMutableArray*)value; NSMutableArray *documentList = [[NSMutableArray alloc] init]; self.myDocList = [[NSMutableArray array] init]; for (int i = 0; i &lt; [result count]; i++) { EDVDocument *docObj = [[EDVDocument alloc]init]; docObj = [result objectAtIndex:i]; [documentList addObject:[docObj docName]]; } self.myDocList = documentList; [docTable reloadData]; } - (void)viewDidUnload { [super viewDidUnload]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { int cnt = [self.myDocList count]; NSLog(@"ABC=%@",cnt); return [self.myDocList count]; //return 1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { DocumentCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DocumentCell"]; if (cell == nil) { cell = [[[DocumentCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DocumentCell"] autorelease]; } NSLog(@"cell text=%@",[self.myDocList objectAtIndex:indexPath.row]); cell.lblDocName.text = [self.myDocList objectAtIndex:indexPath.row]; return cell; } </code></pre> <p>I am using storyboard.I have hooked the "docTable",set the datasource and the delegate for "docTable".The problem is,the service is called after the call to <strong>"numberOfRowsInSection"</strong>.So,<strong>'return [self.myDocList count]'</strong> is 0.I have put <strong>[docTable reloadData]</strong> in <strong>viewWillAppear</strong> as well as in the service handler,that is,<strong>"getDocsByCatIdHandler"</strong>.But it isn't getting reloaded,as expected.Is there anything else I can try? <strong>EDIT</strong>:- This a Master-Detail application.I have used the same code for loading data in the "MasterViewController" UITableViewController and it works.When the user selects a cell in this table,I need to populate data in the second tableview by calling the WCF service.The second tableview isn't displaying data.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload