我正在尝试用Braintree iOS标记信用卡。这是我的代码,类似于文档中的代码。
self.braintree = [Braintree braintreeWithClientToken:self.clientToken];
BTClientCardRequest *request = [BTClientCardRequest new];
request.number = @"4111111111111111";
request.expirationMonth = @"12";
request.expirationYear = @"2018";
[self.braintree tokenizeCard:request
completion:^(NSString *nonce, NSError *error){
}];不幸的是,我没有在项目中找到BTClientCardRequest类,尽管它在Braintree API头目录中。
我的Podfile是这样的:
# Uncomment this line to define a global platform for your project
# platform :ios, "6.0"
source 'https://github.com/CocoaPods/Specs.git'
target "myproj" do
pod 'Braintree'
pod "Braintree/API"
end
target "myprojTests" do
pod 'Braintree'
pod "Braintree/API"
end我的Podfile.lock看起来是这样的:
PODS:
- Braintree (3.3.1):
- Braintree/API
- Braintree/Drop-In
- Braintree/Payments
- Braintree/PayPal
- Braintree/UI
- Braintree/Venmo
- Braintree/API (3.3.1)
- Braintree/Drop-In (3.3.1):
- Braintree/API
- Braintree/Payments
- Braintree/PayPal
- Braintree/UI
- Braintree/Venmo
- Braintree/Payments (3.3.1):
- Braintree/API
- Braintree/PayPal
- Braintree/Venmo
- Braintree/PayPal (3.3.1):
- Braintree/API
- Braintree/UI
- Braintree/UI (3.3.1)
- Braintree/Venmo (3.3.1):
- Braintree/API
DEPENDENCIES:
- Braintree
- Braintree/API
SPEC CHECKSUMS:
Braintree: 34538ea612eb8aa2a1187fb273ac80fd496f0628
COCOAPODS: 0.34.1我真的很困惑,为什么我在我的项目工作区中没有这个类和其他几个类。
发布于 2014-11-03 19:38:07
基于您的Podfile.lock,看起来您已经推出了一个旧版本的Braintree iOS (3.3.1)。在这个版本中,-[Braintree tokenizeCard…]有一个您使用过的略有不同的签名,它基于Braintree的在线文档。
通过在终端运行此命令,我建议升级到最新版本:
$ cd /path/to/your/project
$ pod update Braintree有一个换了这里。
或者,如果不想升级,则可以将代码更改为类似于这的代码。
[braintree tokenizeCardWithNumber:@"4111111111111111"
expirationMonth:@"12"
expirationYear:@"2020"
completion:^(NSString *nonce, NSError *error) {
/* Check for errors and use the `nonce` here. */
}];https://stackoverflow.com/questions/26659310
复制相似问题