【问题标题】:Apple Pay In-App Provisioning CardApple Pay 应用内配置卡
【发布时间】:2018-05-04 11:29:58
【问题描述】:

我正在开发一个应用程序,允许用户通过该应用程序在电子钱包中添加卡支付通行证。为此,您必须要求 Apple 添加以下权利

我还在我的应用中使用“com.apple.developer.payment-pass-provisioning”这些权利 Apple 为我的团队 ID 授予了此权利,修改了我的配置文件并启用了此权利。

尝试使用以下代码从我的应用程序中调用电子钱包应用程序中的添加卡屏幕

PKAddPaymentPassRequestConfiguration *request;
request.cardholderName  = @"xxxxxxxx";
request.primaryAccountSuffix = @"xxxx";
request.localizedDescription = @"This will add the card to Apple Pay";
request.primaryAccountIdentifier = @"test";
request.paymentNetwork = @"Test";

PKPassLibrary *libra;
[libra openPaymentSetup];

PKAddPaymentPassViewController *vc = [[PKAddPaymentPassViewController alloc] initWithRequestConfiguration:request delegate:self];
vc.delegate = self;
[self presentViewController:vc animated:YES completion:nil];

应用程序正在崩溃。错误将 Nil 值传递给 viewcontoller。

【问题讨论】:

  • 您的libra 变量是nil,因为您需要使用PKPassLibrary 的实例对其进行初始化
  • 谢谢,Paul 它对我有用...
  • 现在我可以调用卡片扫描页面并传递卡片详细信息,并使用 PKAddPaymentPassRequestConfiguration 它没有预先填充。你能告诉我我在哪里失踪.....
  • 你知道如何从 iTunes @Paulw11 添加 Card-on-file
  • @Paulw11 如何知道我的银行卡是否已添加到 Apple Wallet 中。

标签: ios objective-c applepay wallet


【解决方案1】:

首先使用加密方案创建 PKAddPaymentPassRequestConfiguration。然后使用此配置创建 PKAddPaymentPassViewController。更新配置变量中所有必需的详细信息。

PKAddPaymentPassRequestConfiguration *config =[[PKAddPaymentPassRequestConfiguration alloc] initWithEncryptionScheme:PKEncryptionSchemeECC_V2];

【讨论】:

  • 嗨。当用户想要将卡详细信息存储到苹果钱包中时,我想从 ios 应用程序调用苹果钱包。所以我在 addPaymentPassVC .let addPaymentPassVC = PKAddPaymentPassViewController.init(requestConfiguration: config!, delegate: self) 中得到了 nil 值。所以我得到了致命错误:Unexpectedly found nil while unwrapping an Optional value。你有什么想法吗
【解决方案2】:

必须初始化 PKPassLibrary 和 PKPaymentPassRequestConfiguration 将 PKPassLibrary *libra; 替换为 PKPassLibrary *libra = [[PKPassLibrary alloc] init];

【讨论】:

  • 嗨。当用户单击 ios 应用程序中的添加卡按钮时,我想显示苹果钱包以保存用户的卡详细信息。怎么做。能否请您提供一些想法
  • 您想从您的应用中添加卡片吗?那么你必须使用上面的代码来初始化PKAddPaymentPassRequestConfiguration
  • 呀。我可以像在swift中一样实现它吗?我正在使用 swift
  • 是的,你可以,但我在目标 C 中实现
  • 我还有一个疑问,当用户点击按钮时是打开苹果钱包还是用户详细信息存储在钱包中?
猜你喜欢
  • 2020-01-03
  • 2017-03-10
  • 1970-01-01
  • 2017-12-02
  • 1970-01-01
  • 2019-03-15
  • 2016-08-02
  • 2016-05-14
  • 2021-03-08
相关资源
最近更新 更多