By default passes are loaded in PKAddPassesViewController
. Is there any way to know which button is pressed on the view.
//this method runs when user either click on the cancel or add button
-(void)addPassesViewControllerDidFinish: (PKAddPassesViewController*) controller
{
[self dismissViewControllerAnimated:YES completion:nil];
}
I want to get the title of the button that is pressed in the PKAddPassesViewController
. I have tried the below code to access the title but i am getting null
.
NSLog(@"Title of button %@",controller.navigationController.navigationItem.rightBarButtonItem.title);
As far as I am aware there is not, but you could always try and retrieve the pass you have just added with:
- (PKPass *)passWithPassTypeIdentifier:(NSString *)identifierserialNumber:(NSString *)serialNumber;
This will return the pass if it was added and nil if not - this could help deduce whether or not a new pass was added.
Note that as well as adding, the right button could be displaying 'Update' (if the pass is already present but your version has new data), or be disabled if you are trying to re-add a duplicate pass.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With