How to implement sending images in quickblox (Swift, iOS, xcode) -


i have app already, , implemented quickblox. far, have message sending. how can add sending images?

to send message attachments should use same way send regular message text, add attachment object.

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 , 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) }) 

there working demo project looking here.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -