【问题标题】:Unable to see update value in Quick Blox Admin Panel无法在 Quick Blox 管理面板中查看更新值
【发布时间】:2017-02-15 12:12:58
【问题描述】:

我正在使用来自以下参考的 QuickBlox SDK

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

在示例聊天中,我也在进行群组视频聊天。但是当我在下面的代码的帮助下更新特定标签时。比我无法在我的 quickblox 管理面板中看到更新的值。如果有人更新标签名称,请建议我。我正在使用下面的代码

  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;
     }];
}

【问题讨论】:

    标签: ios quickblox


    【解决方案1】:

    您的代码只是更新 CoreData 存储中的用户。

    您只能从应用程序更新当前用户:

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

    如果您想更新其他用户,您应该通过管理面板进行。

    Sample chat 与此问题相关。 API Documentation 与此问题相关。

    【讨论】:

    • 我知道这种方法,并且只更新当前用户。我获取所有用户并想要更新特定用户数据。我不想通过管理面板更新用户。通过编程方式如何更新任何用户
    • 基本上我想将示例聊天群组名称更改为群组视频聊天标签。例如---> MyChat 群组名称是 iOS Group。比它将为选定的用户更新此标签名称。
    • 正如我之前写的和文档中所说的,除了通过管理面板之外,无法更新应用程序中的其他用户。
    • @Lalitkumar,您可以在our repo 中创建问题并详细描述所需的行为。我们很乐意提供帮助。
    • @感谢您的回答,您节省了我的时间。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-30
    • 1970-01-01
    • 2016-09-01
    • 2017-10-16
    • 1970-01-01
    相关资源
    最近更新 更多