Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to fill a tableview with sudzc? (My property dont work)
    primarykey
    data
    text
    <p>I have a class that uses sudzc. All works fine, with NSLog I can watch the data of my web services, but when I want to use an array and then use that array in other place, the property is null. I want to fill a table view with the data of the web services, but I can't, How could do it?</p> <p>This is my class</p> <pre><code> // // RootViewController.m // StratargetMovil // // Created by Giovanni Cortés on 30/03/12. // Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #import "RootViewController.h" #import "Page2.h" @interface RootViewController () @end @implementation RootViewController @synthesize myData = _myData; @synthesize empresaID = _empresaID; @synthesize datos = _datos; @synthesize idUnidadNegocio = _idUnidadNegocio; @synthesize idArray = _idArray; -(NSString *)empresaID { _empresaID = @"fce"; return _empresaID; } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization // Do any additional setup after loading the view from its nib. } return self; } - (void)viewDidLoad { // I want to fill the table view but dont work EWSEmpresaWebServiceSvc *service = [[EWSEmpresaWebServiceSvc alloc] init]; [service ConsultarUnidadesOrganizacionalesPorEmpresa:self EmpresaId:self.empresaID]; } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; self.datos = nil; self.myData = nil; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } // Lo de la tabla -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.myData count]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] autorelease]; } NSUInteger row = [indexPath row]; cell.textLabel.text = [self.myData objectAtIndex:row]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Muestra la vista 2 cuando se selecciona una fila [[tableView cellForRowAtIndexPath:indexPath] setSelected:NO animated:YES]; self.idUnidadNegocio = [self.idArray objectAtIndex:indexPath.row]; Page2 *nextNavigator = [[Page2 alloc] init]; [[self navigationController] pushViewController:nextNavigator animated:YES]; [nextNavigator release]; } // ------------------------------------------------- // Consultar unidades organizaciones por empresa - (void) ConsultarUnidadesOrganizacionalesPorEmpresaHandler: (id) value { // Handle errors if([value isKindOfClass:[NSError class]]) { NSLog(@"%@", value); return; } // Handle faults if([value isKindOfClass:[SoapFault class]]) { NSLog(@"%@", value); return; } // Do something with the NSMutableArray* result NSMutableArray *result = (NSMutableArray*)value; NSMutableArray *unidadOrganizacional = [[NSMutableArray alloc] init]; self.myData = [[[NSMutableArray array] init] autorelease]; for (int i = 0; i &lt; [result count]; i++) { EWSUnidadNegocio *empresa = [[EWSUnidadNegocio alloc] init]; empresa = [result objectAtIndex:i]; [unidadOrganizacional addObject:[empresa Descripcion]]; } self.myData = unidadOrganizacional; } -(void)onload:(id)value { // Handle errors if([value isKindOfClass:[NSError class]]) { NSLog(@"%@", value); return; } // Handle faults if([value isKindOfClass:[SoapFault class]]) { NSLog(@"%@", value); return; } // Do something with the NSMutableArray* result NSMutableArray *result = (NSMutableArray*)value; NSMutableArray *unidadOrganizacional = [[NSMutableArray alloc] init]; self.myData = [[[NSMutableArray array] init] autorelease]; for (int i = 0; i &lt; [result count]; i++) { EWSUnidadNegocio *empresa = [[EWSUnidadNegocio alloc] init]; empresa = [result objectAtIndex:i]; NSLog(@"%ld -- %@", [empresa Id], [empresa Descripcion]); // With this I can watch the data in the console [unidadOrganizacional addObject:[empresa Descripcion]]; } self.myData = unidadOrganizacional; // self.myData in another place is null } } @end </code></pre> <p>My data is </p> <p>@property (nonatomic, retain) NSMutableArray *myData;</p> <p>Thanks</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