Skip to content

Reset counter

Resets the current counter value to zero.

- (void)resetWithCounterName:(NSString * _Nonnull)counterName responseHandler:^(void)responseHandler errorHandler:^(Fault * _Nonnull)errorHandler;
func reset(counterName: String, responseHandler: (() -> Void)!, errorHandler: ((Fault) -> Void)!)

where:

Argument                Description
counterName name of the counter to reset.

Example

[Backendless.shared.counters resetWithCounterName:@"MyCounter" responseHandler:^{
    NSLog(@"Counter has been reset");
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
}];

//

id<IAtomic> myCounter = [Backendless.shared.counters ofCounterName:@"MyCounter"];
[myCounter resetWithResponseHandler:^{
    NSLog(@"Counter has been reset");
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
}];
Backendless.shared.counters.reset(counterName: "MyCounter", responseHandler: {
    print("Counter has been reset")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")
})

//

let myCounter = Backendless.shared.counters.of(counterName: "MyCounter")
myCounter.reset(responseHandler: {
    print("Counter has been reset")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")
})