Deleting an Object Body
You can delete only an object body from a KiiObject.
Call the deleteBody(_:)
method to delete an object body as shown in the following sample code:
Swift:
-
// Assume that the KiiObject "object" has been instantiated. do { // Delete the object body of the KiiObject. try object!.deleteBodySynchronous() } catch let error as NSError { // Handle the error. return }
-
// Assume that the KiiObject "object" has been instantiated. // Delete the object body of the KiiObject. object!.deleteBody { (object : KiiObject?, error : Error?) -> Void in if error != nil { // Handle the error. return } }
Objective-C:
-
// Assume that the KiiObject "object" has been instantiated. NSError *error = nil; // Delete the object body of the KiiObject. [object deleteBodySynchronous:&error]; if (error != nil) { // Handle the error. return; }
-
// Assume that the KiiObject "object" has been instantiated. // Delete the object body of the KiiObject. [object deleteBodyWithBlock:^(KiiObject *object, NSError *error) { if (error != nil) { // Handle the error. return; } }];
The deleteBody(_:)
method deletes only an object body. It does not delete a KiiObject.
If you delete an object body that has been published, its URL will be disabled too. JSON data representing an error will be returned if a user tries to access the disabled URL with a browser.