Deleting a Bucket

You can delete a bucket by calling the delete(_:) method of the KiiBucket class. All KiiObjects in the bucket will be deleted accordingly.

Here is the sample code showing how you can delete a bucket:

Swift 3:

  • let bucket = Kii.bucket(withName: "__KII_BUCKET_")
    do{
      try bucket.deleteSynchronous()
    } catch let error as NSError {
      // Handle the error.
      return
    }
  • let bucket = Kii.bucket(withName: "__KII_BUCKET_")
    bucket.delete { (retBucket : KiiBucket, error : Error?) -> Void in
      if (error != nil) {
        // Handle the error.
        return
      }
    }

Objective-C:

  • KiiError *error = nil;
    KiiBucket *bucket = [Kii bucketWithName:@"__KII_BUCKET_"];
    [bucket deleteSynchronous:&error];
    if (error != nil) {
      // Handle the error.
      return;
    }
  • KiiBucket *bucket = [Kii bucketWithName:@"__KII_BUCKET_"];
    [bucket deleteWithBlock:^(KiiBucket *retBucket, NSError *error) {
      if (error != nil) {
        // Handle the error.
        return;
      }
    }];