Return to Snippet

Revision: 70183
at December 9, 2015 03:06 by TenDegrees


Updated Code
Group *tempGroup = [[Group alloc]init];
    tempGroup.entityId=((Member *)self.loggedInUserProfile.memberships[indexPath.row]).groupId;
    
    __block Group *groupToRead = [self.cachedGroupsData objectForKey:[NSNumber numberWithInt:tempGroup.entityId]];
    if(groupToRead)
    {
        cell.cellGroup=groupToRead;
    }

    [self readUnityObject:tempGroup withCompletionBlock:^(id object, bool success, NSString *errorMessage)
     {
         if(success)
         {
             groupToRead=((Group *)object);
             
             dispatch_async(dispatch_get_main_queue(),
            ^{
                cell.cellGroup=groupToRead;
                [self.cachedGroupsData setObject:groupToRead forKey:[NSNumber numberWithInt:groupToRead.entityId]];
            });
         }
         else
         {
             NSLog(@"%@",errorMessage);
         }
     }];

Revision: 70182
at December 9, 2015 03:01 by TenDegrees


Initial Code
Group *tempGroup = [[Group alloc]init];
    tempGroup.entityId=((Member *)self.currentUserMemberships[indexPath.row]).groupId;
    
    __block Group *groupToRead = [self.cachedGroupsData objectForKey:[NSNumber numberWithInt:tempGroup.entityId]];
    if(groupToRead)
    {
        cell.cellGroup=groupToRead;
    }

    [self readUnityObject:tempGroup withCompletionBlock:^(id object, bool success, NSString *errorMessage)
     {
         if(success)
         {
             groupToRead=((Group *)object);
             
             dispatch_async(dispatch_get_main_queue(),
            ^{
                cell.cellGroup=groupToRead;
                [self.cachedGroupsData setObject:groupToRead forKey:[NSNumber numberWithInt:groupToRead.entityId]];
            });
         }
         else
         {
             NSLog(@"%@",errorMessage);
         }
     }];

Initial URL

                                

Initial Description
Reading a Unity Group object from a Unity server.

Initial Title
Reading Unity Objects Example 2: Groups

Initial Tags

                                

Initial Language
Objective C