我怎么知道用户是将第三张卡添加到 iPhone 钱包还是 Apple Watch 钱包?

How can I know if user is add thir card to iPhone wallet or Apple Watch wallet?

我需要在用户将卡添加到 iPhone 时隐藏添加到 Apple Wallet 按钮,但仅在将卡添加到手表时将其保留在屏幕上。我正在研究方法

func addPaymentPassViewController(_ controller: PKAddPaymentPassViewController, didFinishAdding pass: PKPaymentPass?, error: Error?)

但是我找不到在哪里可以看到卡被添加到什么设备

您可以使用 PKLibrarypasses() 函数获取用户 iPhone 钱包中的卡,然后检查是否存在相关卡。要获取手表钱包中的卡片,请使用 remotePaymentPasses()

请注意,您的应用必须有权查看相关卡片,否则返回的数组中将不存在该卡片。我找不到太多关于此的文档,所以我与 Apple 打开了一个 TSI 以尝试获取更多信息。 Apple Pay 钱包团队的某个人回复了我,他们是这样说的:

If the app is entitled to view the card it can query it through PKPassLibrary - either using [PKPassLibrary -passesOfType] for cards locally on the device, or [PKPassLibrary -remotePaymentPasses] for cards on paired watches. We recommend apps use these methods to check if their payment passes are already on the device, and use that info to hide the add to Wallet button. Note, this does require the app to be entitled to view the payment pass. This is normally handled by the issuer, so double check with the issuer that they’re setting the associated app IDs of the payment pass to the app.

仍然没有完全回答我的所有问题,但我建议联系发卡机构(这是我将采取的下一步)。