Search code examples
iosipadios8passbookpasskit

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?


Solution

  • 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