2
我在注册期间有问题图像上传。有一个blobID属性。你告诉我如何可以生成唯一的新用户blobid。我用虚拟整数值检查。我发现这个blobid没有与此用户标识关联。请为我提供更好的解决方案。如何在QuickBlox中注册时使用blobID上传个人资料图片?
我在注册期间有问题图像上传。有一个blobID属性。你告诉我如何可以生成唯一的新用户blobid。我用虚拟整数值检查。我发现这个blobid没有与此用户标识关联。请为我提供更好的解决方案。如何在QuickBlox中注册时使用blobID上传个人资料图片?
你应该做的下一个任务:
使用SWIFT。弹出功能让用户知道他们已被成功添加。
func addUser() {
// add new user
let newUser:QBUUser = QBUUser()
newUser.password = pwTxt.text
newUser.fullName = unTxt.text
newUser.email = emTxt.text
QBRequest.signUp(newUser, successBlock: { (response) in
self.popUp("Signup Success!", msg:"You are now signed up!", button1: "OK!")
// You must be logged in to upload an avatar/image file
QBRequest.logIn(withUserEmail: self.emTxt.text!, password: self.pwTxt.text!, successBlock: { (response: QBResponse, user) in
QBRequest.tUploadFile(imgData, fileName: "image.png", contentType: "image/png", isPublic: true, successBlock: { (response, blob) in
}, statusBlock: { (request, status) in
print("Upload Succcess!")
}, errorBlock: { (response) in
print("Upload Failure!")
})
}, errorBlock: { (response: QBResponse) in
print("Sign In Failed")
})
}, errorBlock: { (response) in
print("Error in SignUp")
})
}
func popUp (_ title: String, msg: String, button1: String){
print("\(title)")
print("\(msg)")
let alert = UIAlertController(title: "\(title)", message: "\(msg)", preferredStyle: UIAlertControllerStyle.alert)
self.present(alert, animated: true, completion: nil)
alert.addAction(UIAlertAction(title: "\(button1)", style: .default, handler: {
action in
alert.dismiss(animated: true, completion: nil)
}))
}
如何创建BLOB? – Steve
如何将图片作为附件发送给quickblox中的离线用户? – Steve
我曾试过以上答案。我无法使用用户凭据登录(谁不是拥有者)我可以从应用程序“内容”上载文件。并且文件仅与所有者相关联。但是,当我从应用程序“内容”的文件的ID设置为不是所有者的用户时,我面临像“Blob不属于当前用户”的错误。请指导我如何为不是应用程序所有者的用户设置blob ID意味着他们属于应用程序“用户”部分。 @Igor Khomenko – kushalrshah