I am working on a project(Swift) using the ResearchKit and my Cancel bar button is not working. I have found the following methods that should make it work
- (void)setCancelButtonItem:(UIBarButtonItem *)cancelButtonItem {
[super setCancelButtonItem:cancelButtonItem];
[cancelButtonItem setTarget:self];
[cancelButtonItem setAction:@selector(cancelButtonHandler:)];
}
- (void)cancelButtonHandler:(id)sender {
STRONGTYPE(self.taskViewController.delegate) strongDelegate = self.taskViewController.delegate;
if ([strongDelegate respondsToSelector:@selector(taskViewController:didFinishWithReason:error:)]) {
[strongDelegate taskViewController:self.taskViewController didFinishWithReason:ORKTaskViewControllerFinishReasonDiscarded error:nil];
}
}
I get the Discard Results and Cancel popup, but nothing happens when I tap the Discard Results option.
Should I check for something else? Should I connect it somewhere?