Lalit kumar
Lalit kumar

Reputation: 2207

Unable to see update value in Quick Blox Admin Panel

I am using QuickBlox SDK from follwing refrence

https://quickblox.com/developers/SimpleSample-chat_users-ios

In Sample chat I am also making Group video chat . but When I Update particular tag With the help of below code. Than I am unable to see the updated value in my quickblox admin panel. If some one update the tag name than Please suggest me. I am using below code

  QBUUser *qbUser = [QBUUser user];
  qbUser.ID = 23429378;
  NSString *roomName = @"ios group";
  qbUser.tags =  @[roomName].mutableCopy;
  NSArray *arry = [[NSArray alloc]initWithObjects:qbUser, nil];
  [QMUsersCache.instance insertOrUpdateUsers:users];

    - (BFTask *)insertOrUpdateUsers:(NSArray *)users
    {
     __weak __typeof(self)weakSelf = self;

    return [BFTask taskFromExecutor:[BFExecutor executorWithDispatchQueue:self.queue] withBlock:^id{
       __typeof(self) strongSelf = weakSelf;

        NSManagedObjectContext* context = [strongSelf backgroundContext];

        NSMutableArray *toInsert = [NSMutableArray array];
        NSMutableArray *toUpdate = [NSMutableArray array];

        //To Insert / Update
        for (QBUUser *user in users)
        {

            CDUser *cachedUser = [CDUser QM_findFirstWithPredicate:IS(@"id", @(user.ID)) inContext:context];
            if (cachedUser) {

                QBUUser *qbCachedUser = [cachedUser toQBUUser];
                if (![user.updatedAt isEqualToDate:qbCachedUser.updatedAt]) {
                   [toUpdate addObject:user];
                }
            }
            else {
                [toInsert addObject:user];
            }
        }

        if (toUpdate.count > 0) {
            [strongSelf updateUsers:toUpdate inContext:context];
        }

        if (toInsert.count > 0) {
            [strongSelf insertUsers:toInsert inContext:context];
        }

        if (toInsert.count + toUpdate.count > 0) {
            [context QM_saveToPersistentStoreAndWait];
        }
        QMSLog(@"[%@] Users to insert %tu, update %tu", NSStringFromClass([weakSelf class]), toInsert.count, toUpdate.count);

        return nil;
     }];
}

Upvotes: 1

Views: 63

Answers (1)

VitGur
VitGur

Reputation: 539

Your code is just updating users in CoreData store.

You can update only the current user from the application:

+ (QBRequest *)updateCurrentUser:(QBUpdateUserParameters *)parameters
                successBlock:(nullable void (^)(QBResponse *response, QBUUser * _Nullable user))successBlock
                  errorBlock:(nullable QBRequestErrorBlock)errorBlock;

If you want to update other users you should do it via Admin Panel.

Sample chat related to this question. API Documentation related to this question.

Upvotes: 0

Related Questions