Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check whether cancel or add button is pressed in PKAddPassesViewController

Tags:

ios6

passbook

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);
like image 434
user1884623 Avatar asked Dec 28 '12 11:12

user1884623


1 Answers

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.

like image 92
PassKit Avatar answered Oct 12 '22 06:10

PassKit