samedi 2 juillet 2016

Backendless: image upload from iOS app


I am making an app that includes a camera. I want my users to be able to save their photo, and submit it to our Backendless files. Currently, they can save their recently taken photo on their own device through this code:

    @IBAction func savePhotoBtn(sender: UIBarButtonItem) {
        let imageData = UIImageJPEGRepresentation(myImageView.image!, 0.6)
        let compressedJPGImage = UIImage(data: imageData!)
        UIImageWriteToSavedPhotosAlbum(compressedJPGImage!, nil, nil, nil)
        let alert = UIAlertView(title: "Save successful",
                            message: "Your image is now saved.",
                            delegate: nil,
                            cancelButtonTitle: "Ok")
    alert.show()
}

Through Backendless support, they keep referring to this documentation, and even though I can get it to work with strings of text, I am unable to translate it to image files:

https://backendless.com/documentation/files/ios/files_file_upload.htm

They have also presented this through their 'Feature-a-Day':

https://backendless.com/feature-31-uploading-files-to-server-with-the-file-upload-api/


Aucun commentaire:

Enregistrer un commentaire