Search code examples
swiftimagesdkcdncloudinary

How destroy image cloudinary swift 3 version


I cant remove images from cloudinary using the iOS sdk, it keeps asking me to provide a signature:

Optional(Error Domain=com.cloudinary.error Code=400 "(null)" UserInfo={message=Missing required parameter - signature})

To remove the image from cloudinary I'm using:

let config = CLDConfiguration(cloudName: self.cloudname, apiKey: self.apiKey)
let cloudinary = CLDCloudinary(configuration: config)
print(self.separateIdFromUrl(url: (photo?.url)!))
_ = cloudinary.createManagementApi().destroy(self.separateIdFromUrl(url: (photo?.url)!))

Solution

  • I just solved my problem, I was managing the urls with a webserver in nodejs. There's a bug with the cloudinary ios sdk according to @ChrisPrince. However you can use the admin api inside the server to make it work:

    cloudinary.v2.api.delete_resources([idCloud], function(error, result){console.log(result);});
    

    if you're having this problem just configure cloudinary in you backend and call this to delete the photos.