ios - Using NSPredicate with Parse for UISearchController -


for updatesearchresultsforsearchcontroller:searchcontroller method possible filter through array of pfusers? table presents list of users , filter through users through search bar.

i've found source of problem , it's this

nspredicate *resultpredicate = [nspredicate                                 predicatewithformat:@"self contains[c] %@",                                 searchtext]; searchresults = [[searchresults filteredarrayusingpredicate:resultpredicate] mutablecopy]; 

where searchresults assigned self.objects returned parse query.

i think problem it's comparing "self" pfuser object string app breaks, tried replace "self" "self.username" reason breaks too. time app run without breaking if assign searchresults array of strings not pfuser objects, need pfuser objects wondering if it's possible use nspredicate on array of pfuser objects?

okay...nevermind it's possible made dumb error

nspredicate *predicate = [nspredicate predicatewithformat:@"self.username contains[cd] %@", searchtext]; 

is correct way, grab username off of object. turns out in separate uitableviewcontroller present new search results, wasn't using "objectforkey=@"username"" when trying present usernames in cell that's why app crashing not because of syntax predicate


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -