Reading Unity Objects Example 2: Groups


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

Reading a Unity Group object from a Unity server.


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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.