2013-05-29 26 views

回答

1

你应该做的下一个任务:

  1. 会员注册用户
  2. 登录用户
  3. 创建BLOB和上传文件 - 您将收到blobID新文件的
  4. 更新用户的blobID场 - 刚刚成立blobID从第3步
+1

如何创建BLOB? – Steve

+0

如何将图片作为附件发送给quickblox中的离线用户? – Steve

+0

我曾试过以上答案。我无法使用用户凭据登录(谁不是拥有者)我可以从应用程序“内容”上载文件。并且文件仅与所有者相关联。但是,当我从应用程序“内容”的文件的ID设置为不是所有者的用户时,我面临像“Blob不属于当前用户”的错误。请指导我如何为不是应用程序所有者的用户设置blob ID意味着他们属于应用程序“用户”部分。 @Igor Khomenko – kushalrshah

1

使用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) 
    })) 

} 
相关问题