【发布时间】:2018-09-03 12:51:38
【问题描述】:
我正在尝试在我的 iOS Xamarin 应用程序上实现设置 Apple Pay 按钮。我已经为它添加了按钮和单击处理程序。然后我使用 PKPassLibrary.OpenPaymentSetup() 打开钱包。然后,如果用户已成功将卡添加到钱包中,我需要通过将“设置 ApplePay 按钮”更改为“使用 Apple Pay 付款”来处理此事件。但我找不到工作任何事件处理程序或类似的东西。
我尝试过的:
private PKPassLibrary _library;
private NSObject _walletNotificationSubscription;
private void OnSetuApplePayClicked(object button, EventArgs args)
{
_library = new PKPassLibrary();
_library.OpenPaymentSetup();
_walletNotificationSubscription = PKPassLibrary.Notifications.ObserveDidChange(_library, HandleEventHandler);
}
void HandleEventHandler(object sender, NSNotificationEventArgs e)
{
_walletNotificationSubscription.Dispose();
ViewModel.UpdateApplePay();
SetButtonVisibility();
}
但它不起作用。
P.S.:我想我可能观察到不正确的事件。
【问题讨论】:
-
您想知道如何确认用户是否已成功将卡添加到钱包中吗?
-
@LucasZ,你是对的。没错。
标签: ios xamarin.ios applepay wallet passkit