Xcode - Array position value is not displayed

Asked

Viewed 140 times

2

I have an array with 30 positions and at each position of the array I have several objects like: Numprocesso, Nome, Idade, Sexo, Datanascimento.

I would like to show all these objects from each position in one line using the Nslog, but I don’t want to concatenate.

Demonstração Demonstração


If I use this:

NSLog(@"Conteúdos no array:  %@", [processosArray objectAtIndex:i]); 

The result will be: Conteúdos no array: 0x8cb1da0

  • What you want to do after all, I did not understand your doubt, what the problem with the array?

  • If I understand correctly you don’t want to use NSLog(@"Conteúdo na posição %i: %@", i, [processosArray objectAtIndex:i]);?? Where is the problem with Array?

  • The problem with the array is that it does not show the contents that are in the positions . Example, if I use this Nslog(@"Content at position %i: %@", i, [processsArray objectAtIndex:i]); Result: position x: 0x8cb1da0

1 answer

1


Good afternoon, Your problem is simple, when you do [processesArray objectAtIndex:i] you are picking up an object of type Searchprocessosobj and your Nslog just showing its memory address.

To show something inside this object you have to cast, something like:

PesquisaProcessosObj *processo = [processosArray objectAtIndex:i];
NSLog("teu log %@", processo.Idade);

Hope I helped, hugs!

  • Thank you, I did it and it works. The counter changes but the data is always the same, it will always fetch the same object. for (i =0; i< [processesValidar.processesArray Count]; i++) { Searchprocessesobj *process = [processesValidar.processesArray objectAtIndex:i]; Nslog(@"Info: %@, %@%@", process.Name, process.; }

  • Try to see by debug, if the problem is not your array now, maybe all the items in the array are the same.

  • All the items in the array were the same because I was using string inside the array. To solve the problem I had to use an array of arrays.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.