Posted By

TenDegrees on 12/09/15


Tagged

Objects Reading groups Unity


Versions (?)

Reading Unity Objects Example 2: Groups


 / Published in: Objective C
 

Reading a Unity Group object from a Unity server.

  1. Group *tempGroup = [[Group alloc]init];
  2. tempGroup.entityId=((Member *)self.loggedInUserProfile.memberships[indexPath.row]).groupId;
  3.  
  4. __block Group *groupToRead = [self.cachedGroupsData objectForKey:[NSNumber numberWithInt:tempGroup.entityId]];
  5. if(groupToRead)
  6. {
  7. cell.cellGroup=groupToRead;
  8. }
  9.  
  10. [self readUnityObject:tempGroup withCompletionBlock:^(id object, bool success, NSString *errorMessage)
  11. {
  12. if(success)
  13. {
  14. groupToRead=((Group *)object);
  15.  
  16. dispatch_async(dispatch_get_main_queue(),
  17. ^{
  18. cell.cellGroup=groupToRead;
  19. [self.cachedGroupsData setObject:groupToRead forKey:[NSNumber numberWithInt:groupToRead.entityId]];
  20. });
  21. }
  22. else
  23. {
  24. NSLog(@"%@",errorMessage);
  25. }
  26. }];

Report this snippet  

You need to login to post a comment.