How to reliably determine whether Passbook is available?
Asked Answered
L

1

5

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?

Lytton answered 17/11, 2014 at 10:11 Comment(0)
L
7

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

Lytton answered 17/11, 2014 at 10:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.