2
我已經有一個應用程序,並實現了Quickblox。到目前爲止,我只有短信發送。我如何添加發送圖像?如何在quickblox中實現發送圖像(Swift,iOS,xcode)
我已經有一個應用程序,並實現了Quickblox。到目前爲止,我只有短信發送。我如何添加發送圖像?如何在quickblox中實現發送圖像(Swift,iOS,xcode)
要發送帶附件的消息,您應該使用與使用文本發送常規消息相同的方式,但添加附件對象。
var imageData: NSData = UIImagePNGRepresentation(UIImage(named: "arrow.png")!)!
QBRequest.TUploadFile(imageData, fileName: "arrow.png", contentType: "image/png", isPublic: false, successBlock: {(response: QBResponse!, uploadedBlob: QBCBlob!) in
// Create and configure message
var message: QBChatMessage = QBChatMessage()
var uploadedFileID: UInt = uploadedBlob.ID
var attachment: QBChatAttachment = QBChatAttachment()
attachment.type = "image"
attachment.ID = String(uploadedFileID)
message.attachments = [attachment]
// Send message
}, statusBlock: {(request: QBRequest?, status: QBRequestStatus?) in
}, errorBlock: {(response: QBResponse!) in
NSLog("error: %@", response.error)
})
有一個完整的工作示範項目,可以做你想要的here。
你能告訴我如何顯示該單元格上的加載器微調器,直到圖像不傳輸? –