4

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.

haresh
  • 486
  • 3
  • 18

2 Answers2

4

Finally i satisfied with customData property in QBUUser.

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

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
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:blabla@gmail.com
login:blabla@gmail.com
phone:9999999999
tags:(null)
lastRequestAt:2014-12-26 13:39:24 +0000
customData:{"user_picture":"myprofileurl.png"} website:(null)

haresh
  • 486
  • 3
  • 18
  • So you are not storing your avatars in quickblox Content module? If I correctly understood you are providing absolute url from third party server. – M.Y. Jan 07 '16 at 16:09
  • Where you upload your image data? on quickblox server or third party server? – Sanjay Shah Nov 16 '17 at 05:03
2

This is the right way

Also there is a blobId field to set the id of file from Content module

Here is an example how to do it http://quickblox.com/developers/SimpleSample-users-ios#Updating_a_profile_picture_.28avatar.29

Rubycon
  • 18,156
  • 10
  • 49
  • 70
  • Ok that means i should pass it as in custom data. Because if i use blob id than i need to create some other logic to retrive it and display in app as i use the SDWebImage to async download and show in the App i need its url rather than the Blob ID. So customData would be great option. @Igor Khomenko – haresh Dec 26 '14 at 12:14
  • Do QuickBlox supports cache handling for image based on Blob id? if it maintains caching policy So i dont require it to use SDWebImage. – haresh Dec 26 '14 at 12:15