I want Cancel action on PKAddPassesViewController to perform some validation but its delegate method addPassesViewControllerDidFinish does not have any property to differentiate between Cancel and AddAll action. Please help to identify which button is tapped to solve this mystery.
Asked
Active
Viewed 233 times
0
-
Can you please show some code? – atalayasa Jun 19 '19 at 13:12
-
func addPassesViewControllerDidFinish(_ controller: PKAddPassesViewController) { controller.dismiss(animated: true) { } } In this method , I need to identify Cancel and AddAll button tap. – Mohit Singhal Jun 19 '19 at 13:13
-
@AtalayAsa Don't know. Do you have any info about these? – Mohit Singhal Jun 19 '19 at 13:17
-
Hi @MohitSinghal Sure this Link will help you! https://stackoverflow.com/questions/14068596/how-to-check-whether-cancel-or-add-button-is-pressed-in-pkaddpassesviewcontrolle – Vicky_Vignesh Jun 19 '19 at 13:28
-
@Vicky_Vignesh I have checked this solution but it does not work. – Mohit Singhal Jun 19 '19 at 13:39
1 Answers
0
Have you tried this ? I know this is a Objective c !
please refer this Link
-(void) addPassesViewControllerDidFinish:(PKAddPassesViewController *)controller {
if (self.HKPass) {
PKPassLibrary *pkLibrary = [[PKPassLibrary alloc] init];
if ([pkLibrary containsPass:self.HKPass])
// add or update clicked
else
// Cancel Clicked
}
[controller dismissModalViewControllerAnimated:YES];
}

Vicky_Vignesh
- 584
- 2
- 14
-
It will not work on second time tap of Cancel button but its doable right now for my one of case but failed in other case. Thanks !! – Mohit Singhal Jun 21 '19 at 08:14