Hi,
Can you tell me a complete example of an IOS image UPLOAD in a non blocking method?.
I have tried unsuccessfully to use the one in the SDK:
func backendless.file.upload(path: String, content: Data, overwrite: Bool, response: (BackendlessFile -> Void), error: (Fault -> Void)) -> Void
Greetings and many thanks in advance,
Hello Joan,
Please check this code:
func uploadImage() {
let filePathName = "MyUplaodedImages/myUploadedImage.png"
let image = UIImage(named: "myImage.png")
let imageData = UIImagePNGRepresentation(image!)
Backendless.sharedInstance().fileService.uploadFile(filePathName, content: imageData, overwriteIfExist: true, response: { uploadedImage in
print("Image has been uplaoded: \(uploadedImage?.fileURL ?? "...")")
}, error: { fault in
print("Error: \(fault?.message ?? "uplaod failed")")
})
}
Result attached.
Regards, Olga
Correctly tested !!