[英]iOS how to take user directly to the Wallet app
I'm integrating Apple Pay now and I see iOS Human Interface Guidelines for Apple Pay.我现在正在集成 Apple Pay,我看到了 Apple Pay 的 iOS 人机界面指南。
https://developer.apple.com/ios/human-interface-guidelines/technologies/apple-pay/ https://developer.apple.com/ios/human-interface-guidelines/technologies/apple-pay/
How can I open the Wallet app when the user taps a button?当用户点击按钮时如何打开电子钱包应用程序?
Check out the PKPaymentButton
.查看
PKPaymentButton
。 There are already pre-built buttons for this as part of PassKit.作为 PassKit 的一部分,已经有为此预先构建的按钮。
let setupButton = PKPaymentButton(type: .setUp, style: .black)
More information can be found at the PKPaymentButton Reference .可以在PKPaymentButton 参考 中找到更多信息。
EDIT:编辑:
PKPassLibrary
can actually perform the action. PKPassLibrary
实际上可以执行该操作。 You can use it like so:你可以像这样使用它:
let library = PKPassLibrary()
library.openPaymentSetup()
More information can be found here .可以在此处找到更多信息。
Note: The above call will only work on a real iOS device.注意:上述调用仅适用于真正的 iOS 设备。
Code in Objective C, same as @Mark answer:目标 C 中的代码,与@Mark 答案相同:
First you have to import PassKit:首先,您必须导入 PassKit:
@import PassKit;
And call func to open Wallet App, func:并调用func打开钱包App,func:
-(void) openAppleWalletApp {
PKPassLibrary * wallet = [[PKPassLibrary alloc] init];
[wallet openPaymentSetup];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.