我正在将Paypal ios SDK 2.1版集成到我的应用程序中,但遇到了问题。
即使我在付款完成后致电[PayPalMobile clearAllUserData]
,SDK似乎也会将过期的支付卡留在内存中。
@interface AirliftCartViewController : AirliftViewController <AVCaptureMetadataOutputObjectsDelegate, UITableViewDelegate, AirliftCartTotalsChangeDelegate, PayPalPaymentDelegate>
@property (strong) AVCaptureSession * captureSession;
@property (strong, nonatomic) UIView *cameraPreview;
@property (nonatomic, strong, readwrite) PayPalConfiguration *payPalConfiguration;
- (IBAction)initiateCreditCardCheckout:(id)sender;
@end
...
@implementation AirliftCartViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil timeout:(NSUInteger)timeoutInSeconds screenName:(NSString *)screenName
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil timeout:timeoutInSeconds screenName:@"AirliftCartView"];
if (self) {
// Custom initialization
self.payPalConfiguration = [[PayPalConfiguration alloc] init];
self.payPalConfiguration.rememberUser = NO;
}
return self;
}
- (void)payPalPaymentDidCancel:(PayPalPaymentViewController *)paymentViewController
{
NSLog(@"payment cancelled!");
// The payment was canceled; dismiss the PayPalPaymentViewController.
[paymentViewController dismissViewControllerAnimated:YES completion:^{
// clear all paypal user information
[PayPalMobile clearAllUserData];
}];
}
- (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment
{
NSLog(@"Payment was successful");
// Payment was processed successfully; send to server for verification and fulfillment.
[self verifyCompletedPayment:completedPayment];
// Dismiss the PayPalPaymentViewController.
[paymentViewController dismissViewControllerAnimated:YES completion:^{
// clear all paypal user information
[PayPalMobile clearAllUserData];
// emptycart
[self.cartController emptyCart];
// reset metadata
[self.metaDataFound removeAllObjects];
}
- (IBAction)initiateCheckout:(id)sender {
NSLog(@"checkout requested!");
[PayPalMobile preconnectWithEnvironment:PayPalEnvironmentSandbox];
// present paypal payment
PayPalPaymentViewController * payPalVC = [[PayPalPaymentViewController alloc]
initWithPayment:[self.cartController getPayPalPaymentFromCart]
configuration:self.payPalConfiguration delegate:self];
[self presentViewController:payPalVC animated:YES completion:^{
[self.captureSession stopRunning];
[self.cameraPreview removeFromSuperview];
}];
}
@end
我像这样展示PayPalPaymentViewController(因此我无法对其进行强烈的引用)
我的应用程序保留任何卡信息,任何人的想法都不能接受吗?
编辑:按要求添加用户步骤:
编辑2:添加了captureSession
和cameraPreview
的属性声明以及展开的init
定义
编辑3:添加了截图
答案 0 :(得分:1)
戴夫来自PayPal。
几个问题:
(1)您的captureSession
和cameraPreview
发生了什么?
(2)从用户的角度来看,您能否提供一系列具体步骤来重现您的问题?
(3)SDK将卡数据保存在内存中的指示是什么?
(4)您运行的是哪个版本的SDK?我猜它是最新版本之一,2.1.5或2.1.6?
*编辑(2014年8月1日):最初描述的错误已在我们的latest release中修复。 * 强>
答案 1 :(得分:0)
您还可以在PayPalConfiguration https://github.com/paypal/PayPal-iOS-SDK/blob/master/PayPalMobile/PayPalConfiguration.h#L57中设置remeberUser = NO,因此SDK甚至不会尝试保存任何内容。