Posted By

TenDegrees on 12/10/15


Tagged

search Unity TenDegrees


Versions (?)

Searching for Groups and Contacts in Unity


 / Published in: Objective C
 

Using the searchUnity function to read groups and contacts from a Unity server based on a search string.

  1. static bool groupSearchIsOn = YES;
  2.  
  3. [self searchUnity:self.contactSearchBar.text withCompletionBlock:^(NSArray * array, bool success, NSString * errorMessage)
  4. {
  5. if(success && ![self.contactSearchBar.text isEqualToString:@""])
  6. {
  7. if(array)
  8. {
  9. NSMutableArray *temp = [[NSMutableArray alloc]init];
  10. for(NSObject *object in array)
  11. {
  12. if(groupSearchIsOn)
  13. {
  14. if(((Entity *)object).isGroup)
  15. {
  16. [temp addObject:object];
  17. }
  18.  
  19. }
  20. else
  21. {
  22. if(!((Entity *)object).isGroup)
  23. {
  24. if(![self.allContacts objectForKey:[NSNumber numberWithInt:((Entity *)object).entityId]])
  25. {
  26. [temp addObject:object];
  27. }
  28. }
  29.  
  30. }
  31.  
  32. }

Report this snippet  

You need to login to post a comment.