Skip to content

Triggering Delete Event

To trigger an event, delete an Order object from the Backendless database. This can be done with any Backendless SDK (Android, iOS, JS, .NET), REST API or Backendless Console:

Consider the following class:
@interface Order : NSObject

@property(strong, nonatomic) NSString *objectId;
@property(strong, nonatomic) NSString *orderName;
@property(strong, nonatomic) NSNumber *orderAmount;

@end
The code below creates an instance of the class and saves in the Backendless Database:
Order *order = // an existing Order object     

DataStoreFactory *dataStore = [Backendless.shared.data of:[Order class]];
[dataStore removeWithEntity:order responseHandler:^(NSNumber *removed) {
    NSLog(@"Order has been deleted");
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
}];
Consider the following class:
@objcMembers class Order: NSObject {
    var objectId: String?
    var orderName: String?
    var orderAmount: NSNumber?
}
The code below creates an instance of the class and saves it in the Backendless Database:
let order = // an existing Order object

let dataStore = Backendless.shared.data.of(Order.self)
dataStore.remove(entity: order, responseHandler: { removed in
    print("Order has been deleted")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")
})

NSDictionary *order = // an existing Order object

MapDrivenDataStore *dataStore = [Backendless.shared.data ofTable:@"Order"];
[dataStore removeWithEntity:order responseHandler:^(NSNumber *removed) {
    NSLog(@"Order has been deleted");
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
}];
let order = // an existing Order object

let dataStore = Backendless.shared.data.ofTable("Order")
dataStore.remove(entity: order, responseHandler: { removed in
    print("Order has been deleted")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")
})