0

在我的应用程序中,用户可以搜索在一个名为“”的自定义类中UISearchController实现的其他用户。UITableViewControllerFindUsersTableViewController

因此,我从parse data browser加载用户,过滤用户似乎可以正常工作,因为我可以在控制台中看到它,但问题出在这一点:下面,这是一个自定义函数,我将过滤后的用户存储在一个NSMutableArray被调用的“ userSearchResults”(在文件中声明为属性FindUsersTableViewController.h):

- (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);
}

self.userSearchResults 中没有存储任何内容

有谁可以帮我解决这个问题?

4

0 回答 0