Ajay Babu Singineedi
Ajay Babu Singineedi

Reputation: 195

How to retrieve Avatar images of users in Quickblox

I am using Quickblox API and successfully uploading, fetching and retrieving the Avatar image of the user.But in my app i want to show the list of users when a user logs in. How to get the users avatars.

I am getting the list of users (QBUsers) but in that BlobId is Null for everyone, though Avatar images are existing for the users.

Please help me for fetching avatars of the users.

Upvotes: 0

Views: 496

Answers (1)

Ajay Babu Singineedi
Ajay Babu Singineedi

Reputation: 195

 func downloadTeamMemberAvatar(avatarFileId:String,completion:      (UIImage?)->Void){

    let id = UInt(avatarFileId)

    if let _ = id{

        QBRequest.downloadFileWithID(id!, successBlock: { (_, imageData) in

            let image = UIImage(data:imageData)

            completion(image)

            }, statusBlock: { (_, _) in

            }, errorBlock: { (_) in

                completion(nil)
        })

    }else{completion(nil)}

}

Upvotes: 1

Related Questions