Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableView cells not being populated
    text
    copied!<p>I am getting a list of some <code>ShoppingLists</code> through a <code>WCF</code> call. </p> <p>My code: </p> <pre><code>#import "ListTableViewController.h" #import "ListServiceSvc.h" @interface ListTableViewController (){ // NSMutableArray *shoppingLists; } @property (nonatomic, retain) NSMutableArray *shoppingList; @end @implementation ListTableViewController - (id)initWithStyle:(UITableViewStyle)style { self = [super initWithStyle:style]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { _shoppingList = [NSMutableArray array]; [self loadListsFromRemoteServer]; [super viewDidLoad]; } -(void) loadListsFromRemoteServer { NSString *uname = @"Test4"; NemListBinding *binding = [[ListServiceSvc NemListBinding]initWithAddress:@"http://balder.ucn.dk/dm76_gr5/WCF.ListService.svc/custom?singleWsdl"]; binding.logXMLInOut=YES; ListServiceSvc_GetShoppingListsWithUname *parms = [[ListServiceSvc_GetShoppingListsWithUname alloc]init]; parms.uname = uname; [binding GetShoppingListsWithUnameAsyncUsingParameters:parms delegate:self]; } - (void) operation:(NemListBindingOperation *)operation completedWithResponse:(NemListBindingResponse *)response { NSArray *responseHeaders = response.headers; NSArray *responseBodyParts = response.bodyParts; //[NSThread sleepForTimeInterval:5.0]; NSMutableArray *shoppingListFromWebserver = [[NSMutableArray alloc] init]; // step 1 fill in the blanks. for(id header in responseHeaders) { // here do what you want with the headers, if there's anything of value in them } for (id mine in responseBodyParts) { if ([mine isKindOfClass:[ListServiceSvc_GetShoppingListsWithUnameResponse class]]) { for (id slist in [[mine GetShoppingListsWithUnameResult] ShoppingList]) { [shoppingListFromWebserver addObject:slist]; NSLog(@"new list :: RESPONSE FROM SERVER :: nList %@", [slist ShoppingListName]); //self.result.text = [self.result.text stringByAppendingString:[slist shoppingListName]]; } } } [self performSelectorOnMainThread:@selector(updateNewView:) withObject:shoppingListFromWebserver waitUntilDone:NO]; } -(void) updateNewView:(NSMutableArray*) result { _shoppingList = result; NSLog( @"new list - number of news :: %u", [_shoppingList count]); [self.tableView reloadData]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } #pragma mark - Table view data source //- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView //{ // return _shoppingList.count; //} //- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section //{ // // Return the number of rows in the section. // return 10; //} - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"cellforrow"); static NSString *CellIdentifier = @"ListCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; } //cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; // Configure the cell... id shopList = [_shoppingList objectAtIndex:indexPath.row]; cell.textLabel.text = [shopList ShoppingListName]; return cell; } </code></pre> <p>Nothing happens when i run the app in Xcode. I can see in the log window that the log </p> <pre><code>NSLog( @"new list - number of news :: %u", [_shoppingList count]); </code></pre> <p>does return a value <strong>(4)</strong>, but the <code>NSLog</code> i have made in the <code>CellForRowAtIndexPath</code> method does not get printed. I also have a breakpoint in there, that isn't reached. Why is it not getting to the method?</p>
 

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