In my app, User can search other users with UISearchController
implemented in a UITableViewController
custom class called: "FindUsersTableViewController
".
So, I load the users from parse data browser, filtering users seems to work properly as I can see it in the console, but the problem is at that point: below, this is a custom function where I store the filtered users in a NSMutableArray
called "userSearchResults
" (declared as property in the FindUsersTableViewController.h
file):
- (void)updateFilteredContentForUsername:(NSString *)usrNameString
{
[self.userSearchResults removeAllObjects];
// "self.allUsers" is the Array declared in the ".h" file used to get all the users with a query from the parse data browser
for (PFUser *user in self.allUsers) {
NSString *tempUsername = user.username;
if ([[tempUsername lowercaseString] hasPrefix:[usrNameString lowercaseString]]) {
[self.userSearchResults addObject:user];
// The code below works well, when I am typing on textfield of the SearchController's UISearchBar, I can see in the console all the filtered users
NSLog(@"%@", tempUsername);
}
}
// The code below shows "(null)" in the console
NSLog(@"REMPLISSAGE: %@", self.userSearchResults);
}
Nothing stored in self.userSearchResults
Does anyone could help me to fix that issue ?