Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reliably determine whether Passbook is available?

Apple provides a dedicated method in Passkit to determine whether the PassLibrary is available:

[PKPassLibrary isPassLibraryAvailable]

This works as expected on iPhone and iPad with one exception: The iPad Air 2 returns YES but it seems that it does not support any UI to add a pass. Invocation of

[[PKAddPassesViewController alloc] initWithPass:aValidPass]

returns nil.

Is there any option to check reliably whether PassLibrary, including UI, is available WITHOUT having a pass beforehand?

like image 941
DEAD10CC Avatar asked Nov 17 '14 10:11

DEAD10CC


1 Answers

From isPassLibraryAvailable

Do not use this method to determine whether the user can add passes on this device. A device may have a pass library, but still not be able to add passes. Use the PKAddPassesViewController class’s canAddPasses() method instead.

You should use PKAddPassesViewController for this, which returns whether the device supports adding passes.

[PKAddPassesViewController canAddPasses]

since iOS8

like image 143
DEAD10CC Avatar answered Oct 23 '22 15:10

DEAD10CC