简体   繁体   English

在iOS中集成Stripe SDK(Swift)

[英]Integrate Stripe SDK in iOS (Swift)

I added Stripe SDK to my iOS app (added PassKit.framework alongside the StripePublishableKey in AppDelegate) via manual installation, but I came across one of two issues when the import statement (tried both #import <Stripe/Stripe.h> and #import "Stripe.h" ) was added to the bridging header file: 我通过手动安装将Stripe SDK添加到我的iOS应用程序(在AppDelegate中与StripePublishableKey一起添加了PassKit.framework),但是当导入语句(尝试#import <Stripe/Stripe.h>#import "Stripe.h"时)遇到两个问题之一#import "Stripe.h" )已添加到桥接头文件中:

1) With #import <Stripe/Stripe.h> , the bridging header no longer imports, despite having worked before. 1)使用#import <Stripe/Stripe.h> ,即使之前已经工作过,桥接头也不再导入。 (I checked Swift Compiler under Build Settings and the file is correct. Plus once I removed elements of Stripe, the problems went away). (我在“构建设置”下检查了Swift Compiler,文件正确。此外,一旦删除了Stripe的元素,问题就消失了)。

2) With #import "Stripe.h" , I get errors that indicate that the SDK isn't picked up at all. 2)使用#import "Stripe.h" ,出现错误,表明根本没有拾取SDK。

(I've checked the SO archive for relevant threads, which pointed to the aforementioned import statements as possible solutions. And, as a Swift learner, I'm not as familiar with implementing Obj-C solutions. I cobbled what I could from Stripe's documentation.) (我已经检查了SO存档中的相关线程,这些线程指出了上述的import语句是可能的解决方案。而且,作为一名Swift学习者,我对实施Obj-C解决方案并不熟悉。文档。)

Is this a Stripe problem? 这是条纹问题吗? What am I missing in implementation? 我在实施中缺少什么?

This worked for me and hopefully this will be helpful for anyone who finds himself/herself in the same predicament. 这对我有用,希望这对发现自己陷入困境的任何人都将有所帮助。 First, it's #import <Stripe/Stripe.h> . 首先是#import <Stripe/Stripe.h> Next, adding turning on Passbook under Capabilities allowed Passkit.framework to be linked to the app (or recognized in the library). 接下来,在“功能”下添加“启用存折”,可以将Passkit.framework链接到应用程序(或在库中识别)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM