本文介绍了在iOS聊天室的QuickBlox QBUUser中设置聊天室/头像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在QuickBlox中,我们获取在QuickBlox中注册的每个用户的QBUUser实例.但是我没有找到任何属性来设置头像照片的头像网址并进行更新.我正在考虑在属性customData中设置url.这是设置头像网址的正确方法,还是存在其他任何方式让我知道.提前致谢.

Here in QuickBlox we get the QBUUser instance of each user registered with the QuickBlox . But i did not found any property to set the avatar url for profile photo and update it. I was thinking to set url in property customData . Is this right way to set avatar Url or if any other way exist let me know. Thanks in Advance.

推荐答案

最后,我对QBUUser中的customData属性感到满意.

Finally i satisfied with customData property in QBUUser.

我刚刚创建了一个字典,并在该字典中的某个Key中设置了网址.

I just created a dictionary and set url in that dictionary within some Key.

然后创建了它的JSON字符串,并在QBUUser属性customData中对其进行了设置,并对其进行了更新.这是它的小代码段.

Than created its JSON string and set it in the QBUUser property customData and updated it and it worked. Here is its small code snippet.

        QBUUser *user = [QBUUser user];
        user.ID = qbUserID; // Set User id so it updates that user
       NSDictionary *dict = @{kUserPicture:@"myprofileurl.png"}; // Created dictionary to store Avatar URl
       user.customData=[dict JSONRepresentation]; // Created its Json String

      [QBRequest updateUser:user successBlock:^(QBResponse *response, QBUUser *user) {
            NSLog(@"customData %@",user.customData);
        } errorBlock:^(QBResponse *response) {

    }];

在成功的区块中,我得到了这个答复

And in success block i got this response

ID:qbID
创建于:2014-12-26 13:04:56 +0000 更新于:2014-12-26 13:05:02 +0000
externalUserID:45454 blobID:0 facebookID :(空) twitterID :(空)
全名:布拉布拉
电子邮件:[email protected]
登录名:[email protected]
电话:9999999999
标签:(空)
lastRequestAt:2014-12-26 13:39:24 +0000
customData:{"user_picture":"myprofileurl.png"} 网站:(空)

ID:qbID
created at:2014-12-26 13:04:56 +0000 updated at:2014-12-26 13:05:02 +0000
externalUserID:45454 blobID:0 facebookID:(null) twitterID:(null)
full name:blabla
email:[email protected]
login:[email protected]
phone:9999999999
tags:(null)
lastRequestAt:2014-12-26 13:39:24 +0000
customData:{"user_picture":"myprofileurl.png"} website:(null)

这篇关于在iOS聊天室的QuickBlox QBUUser中设置聊天室/头像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-03 14:01