无法在iPhone 6上打开Apple Pay表 [英] Failed to open Apple Pay sheet on iPhone 6

查看:63
本文介绍了无法在iPhone 6上打开Apple Pay表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个示例项目,当用户单击我的应用程序上的使用Apple Pay付款"按钮时,打开Apple Pay表.

I want to make an example project that open an Apple Pay sheet when user clicks on the 'Pay with Apple Pay' button on my app.

我在具有iOs版本8.1(包含Apple Pay)和Xcode 6.1 GM的iPhone 6上测试了我的应用程序.他们两个都尚未正式发布.

I test my app on an iPhone 6 with iOs version 8.1 (which contains Apple Pay) and Xcode 6.1 GM. Both of them have not been officially released yet.

我遵循了此页面上的教程.这是我的代码,用于处理使用Apple Pay付款"按钮的点击事件:

I followed the tutorial on this page. And this is my code for handling the on-click event of 'Pay with Apple Pay' button:

PKPaymentRequest *request = [PKPaymentRequest new];

// Must be configured in Apple Developer Member Center
// Doesn't seem like the functionality is there yet
request.merchantIdentifier = @"my.valid.merchant.identifier";

request.countryCode = @"US";
request.currencyCode = @"USD";

// Let's go!
// if (![PKPaymentAuthorizationViewController canMakePayments]) return;
PKPaymentAuthorizationViewController *authVC = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:request];
authVC.delegate = self;
[self presentViewController:authVC animated:YES completion:nil];

点击使用Apple Pay付款"按钮时,出现此错误:

Clicking on the 'Pay with Apple Pay' button, I got this error:

由于未捕获的异常"NSInvalidArgumentException"而终止应用程序,原因:应用程序试图在目标上显示nil模态视图控制器

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target

在检查 PKPaymentAuthorizationViewController canMakePayments] 时,它返回false.

When checking the PKPaymentAuthorizationViewController canMakePayments], it returns false.

我不确定我的错误原因是iPhone的设置还是我的代码.

I'm not sure about the reason of my error is of the iPhone's setting or my code.

有人有使用Apple Pay的经验吗?请帮我.非常感谢.

Does someone have the experience with Apple Pay? Please help me. Thank you so much.

推荐答案

我在装有iOs 8.1(包含Apple Pay)的iPhone 6上测试了我的应用程序

I test my app on an iPhone 6 with iOs version 8.1 (which contains Apple Pay)

否,最新的Beta(iOS 8.1 Beta 2)不包含Apple Pay.在开发人员的过程中,显然会有一些东西在里面,但是它还不适合开发人员使用.

No, the most recent beta (iOS 8.1 Beta 2) does not contain Apple Pay. There's obviously some stuff in there under the hood as they're working on it, but it's not intended to work for developers yet.

这就是为什么 [PKPaymentAuthorizationViewController canMakePayments] 返回 NO authVC nil 的原因.设置"中也没有Apple Pay,发行说明.

This is why [PKPaymentAuthorizationViewController canMakePayments] returns NO and authVC is nil. Apple Pay is also not available in Settings, nor is it mentioned in the release notes.

这篇关于无法在iPhone 6上打开Apple Pay表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆