This topic describes how to delete an object.

Warning Deleted objects cannot be recovered. Use caution when deleting objects.

Use the following code to delete an object:

OSSDeleteObjectRequest * delete = [OSSDeleteObjectRequest new];
delete.bucketName = @"<bucketName>";
delete.objectKey = @"<objectKey>";

OSSTask * deleteTask = [client deleteObject:delete];

[deleteTask continueWithBlock:^id(OSSTask *task) {
    if (! task.error) {
        // ...
    return nil;

// [deleteTask waitUntilFinished];
Note To delete the object, you must have the write permission on the bucket where the object resides.