I am making an application for registering students from a school using TabBar, and one of the Tabs is the Query Tab.
In this tab, I have a search field, where the user must enter the name of the student and it will appear in a TextView, after clicking the search button.
I'm using the Parse server, which provides me with "Query" methods for the data, including already providing an Array where objects are stored.
My search method, the action of the fetch button, looks like this:
- (IBAction)buscarAlunos:(id)sender {
// Busca
PFQuery *query = [PFQuery queryWithClassName:@"Aluno"];
// Busca com as Keys abaixo
[query selectKeys:@[@"firstName",@"lastName",@"telephone,classDate"]];
// Método fornecido pelo Parse
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
// Método para efetuar a busca no Array objects com os dados do campo
[query whereKey:self.buscarTextField.text containsAllObjectsInArray:objects];
// Array para guardar os itens da busca
NSMutableArray* busca = [[NSMutableArray alloc]init];
[busca addObject:[NSString stringWithFormat:@"%@",[objects componentsJoinedByString:@"\n"]]];
// Exibir no textView
self.textViewResgate.text = [busca componentsJoinedByString:@"\n"];
}];
}
The problem that occurs is that my textView
always displays the results with the keys and some codes. I believe I'm not formatting correctly.
The result looks like this:
<Aluno: FA49wkjYMA:(null)>{
firstName=Jose
lastName=da Silva
}
Would I have to get those keys and codes? I do not know if stringWithFormat
is the best way to display.