Closed JohnOHFS closed 2 years ago
Here's how I was able to get it working:
private func uploadPhoto(image: UIImage){
let config = CLDConfiguration(cloudName: "my_sample_cloud", secure: false)
let cloudinary = CLDCloudinary(configuration: config)
if let image = image.pngData() {
cloudinary.createUploader().upload(
data: image, uploadPreset: "my_preset") { progress in
print(progress.fractionCompleted * 100)
} completionHandler: { result, error in
guard let results = result else { return }
DispatchQueue.main.async {
let photoObject: () = self.photoPicker.photoVM.cloudinaryMedia.append(results.self)
}
}
}
}
Bug report for Cloudinary iOS SDK
Before proceeding, please update to latest version and test if the issue persists
Describe the bug in a sentence or two.
I'm trying to setup a function to capture the response from an API request and map it to a Model once the result hits. Getting the subject error when I try and do something with the results. Trying to map it to a Model that matches the expected return object.
Issue Type (Can be multiple)
[ ] Build - Can’t install or import the SDK [ ] Performance - Performance issues [ ] Behaviour - Functions aren’t working as expected (Such as generate URL) [ ] Documentation - Inconsistency between the docs and behaviour [x] Other (Specify)
Steps to reproduce
… if applicable
Error screenshots or Stack Trace (if applicable)
Build/Dependency management
[ ] Cocoa-Pods [ ] Carthage [x] Manual import [ ] Other (Specify)
Is the issue reproducible only on a specific device?
[ ] No [ ] Yes (specify model + iOS version)
Versions and Libraries (fill in the version numbers)
iOS Cloudinary SDK version - 0.0.0 OSX (on the dev environment) - 0.0.0 XCode - 0.0.0 Swift - 0.0.0 Target iOS - 0.0.0
Repository If possible, please provide a link to a reproducible repository that showcases the problem