Search code examples
iosweb-servicestableviewsudzc

Why mi property do not save the value when I use SudzC?


I am using SudzC to get webservices, that webservice give me data, I tried to save the data in a property, but when I use to fill a tableview the property don't have any data. I use the debugger to view the property.

This es my handler

- (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];

for (int i = 0; i < [result count]; i++)
{
    EWSUnidadNegocio *empresa = [[EWSUnidadNegocio alloc] init];
    empresa = [result objectAtIndex:i];
    [unidadOrganizacional addObject:[empresa Descripcion]];

}

self.myData = unidadOrganizacional;

}

And this is the part where I use the web service

- (void)viewDidLoad

{

// Do any additional setup after loading the view from its nib.

EWSEmpresaWebServiceSvc *service = [[EWSEmpresaWebServiceSvc alloc]init];


[service ConsultarUnidadesOrganizacionalesPorEmpresa:self action:@selector(ConsultarUnidadesOrganizacionalesPorEmpresaHandler:) EmpresaId:self.empresaID];

[super viewDidLoad];

}

And the tableview is empty. Why does this happen? How can I use the data and fill my tableview?


Solution

  • I found the answer, I just have to put

    [_myTableView reloadData]
    

    at the end of the method.