以前我使用的是Braintree iOS v3 SDK,但它似乎不再有效,所以我已经改为iOS v4 SDK。
我在这里遇到的问题是当我点击任何按钮时,根本没有任何回复。可能是什么问题?我错过了设置中的某些内容吗?我遵循了Braintree提供的完全相同的步骤。
文档链接:https://developers.braintreepayments.com/start/hello-client/ios/v4#present-drop-in-ui
我的代码
- (void)viewDidLoad {
[super viewDidLoad];
self.clientToken = @"token"; //token
}
- (void)showDropIn:(NSString *)clientTokenOrTokenizationKey {
BTDropInRequest *request = [[BTDropInRequest alloc] init];
BTDropInController *dropIn = [[BTDropInController alloc] initWithAuthorization:clientTokenOrTokenizationKey request:request handler:^(BTDropInController * _Nonnull controller, BTDropInResult * _Nullable result, NSError * _Nullable error) {
if (error != nil) {
NSLog(@"ERROR");
} else if (result.cancelled) {
NSLog(@"CANCELLED");
[self dismissViewControllerAnimated:YES completion:nil];
} else {
result.paymentOptionType = BTUIKPaymentOptionTypePayPal;
}
}];
[self presentViewController:dropIn animated:YES completion:nil];
}
- (IBAction)callBrainTree:(id)sender
{
[self showDropIn:self.clientToken];
}
非常感谢任何建议。