这是我的代码..
-(voID) vIEwDIDAppear:(BOol)animated { // request is initialized here. paymentPane = [[PKPaymentAuthorizationVIEwController alloc] initWithPaymentRequest:request]; //paymentPane is not nil. paymentPane.delegate = self; [self presentVIEwController:paymentPane animated:TRUE completion:nil];}
调用上述功能并成功显示Apple Pay VIEw Controller以验证付款.我已从委托实现了以下方法,如下所示:
-(voID)paymentAuthorizationVIEwControllerDIDFinish:(PKPaymentAuthorizationVIEwController *)controller { [self dismissVIEwControllerAnimated:YES completion:nil];}- (voID)paymentAuthorizationVIEwController:(PKPaymentAuthorizationVIEwController *)controller dIDAuthorizePayment:(PKPayment *)payment completion:(voID (^)(PKPaymentAuthorizationStatus))completion { NSLog(@"%@",[payment.token description]); completion(PKPaymentAuthorizationStatusSuccess);}
理想情况下,它首先命中dIDAuthorizePayment,我们在其中验证付款,如果成功则传递成功,然后调用paymentAuthorizationVIEwControllerDIDFinish并用于完成事务并隐藏Apple VIEw Controller.我在那里放置断点并且它击中了两个函数,但VIEwController不会消失.即使您点按Apple Pay VIEw中的取消按钮也不会发生这种情况.
我的类声明如下,并实现了所需的委托.
@interface ApplePayManager : UIVIEwController<PKPaymentAuthorizationVIEwControllerDelegate,UIAlertVIEwDelegate>
关于我做错了什么的任何想法?为什么视图控制器没有消失?
最后,我对iOS有点新鲜.所以我很欣赏指南和/或链接,以澄清我的疑虑!
已经看过了:
http://www.raywenderlich.com/87300/apple-pay-tutorial
https://dzone.com/articles/integrating-your-ios-app-apple
UIVIEwController *rootVIEwController = [[[UIApplication sharedApplication] keyWindow] rootVIEwController]; [rootVIEwController presentVIEwController:paymentPane animated:TRUE completion:nil];总结
以上是内存溢出为你收集整理的ios – 无法解雇PKPaymentAuthorizationViewController全部内容,希望文章能够帮你解决ios – 无法解雇PKPaymentAuthorizationViewController所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)