【发布时间】:2016-07-19 19:26:22
【问题描述】:
我正在使用 QBChatMessage 来获取聊天中发送的所有消息。
我已经在 quickblox 的管理面板中上传了用户的图片。现在,我在从 quickblox 内容中获取图像时遇到了问题。
如果有人知道,请帮助我。 因为我已经尝试使用 message.senderID 获取用户图像,但没有成功。
【问题讨论】:
标签: ios objective-c swift quickblox
我正在使用 QBChatMessage 来获取聊天中发送的所有消息。
我已经在 quickblox 的管理面板中上传了用户的图片。现在,我在从 quickblox 内容中获取图像时遇到了问题。
如果有人知道,请帮助我。 因为我已经尝试使用 message.senderID 获取用户图像,但没有成功。
【问题讨论】:
标签: ios objective-c swift quickblox
您尝试过这种方法吗?首先你应该通过id获取用户,然后检查他的avatarURl和blobID
QBRequest.userWithID(message.senderID, successBlock: { (response :QBResponse?, user:QBUUser?) in
if user?.avatarUrl == nil {
//no avatar. Download file by user's blob id
let userProfileBlobUID = user?.blobID
QBRequest.downloadFileWithID(UInt(userProfileBlobUID!), successBlock: { (response : QBResponse,imageData: NSData) in
let image = UIImage(data:imageData)
}, statusBlock: nil, errorBlock: nil)
}
else {
//download image by url
}
}) { (response :QBResponse) in
}
【讨论】: