Searching for Groups and Contacts in Unity


/ Published in: Objective C
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.