Braintree Paypal authorization doesn't work on iOS >9

时间:2016-03-02 10:50:11

标签: ios objective-c paypal authorization braintree

I integrated Braintree SDK into my iOS app project using Cocoa Pods. Version of the Braintree SDK installed is 4.1.3. I followed guide on Braintree web site (https://developers.braintreepayments.com/guides/paypal/overview/ios/v4) to set up custom button that will start the process of paypal user authorization. After implementing everything as suggested in the web giude, I tested paypal authorization with sandbox environment on device with iOS 8.4 installed. Everything works flawlessly, but when I tried my app on device with iOS 9.2 installed I couldn't authorize with paypal. I set some breakpoints in project and discovered that this method, which is implemented in BTAppSwitch.m file, always returns NO:

- (BOOL)handleOpenURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication {
    for (Class<BTAppSwitchHandler> handlerClass in self.appSwitchHandlers) {
        if ([handlerClass canHandleAppSwitchReturnURL:url sourceApplication:sourceApplication]) {
            [handlerClass handleAppSwitchReturnURL:url];
            return YES;
        }
    }
    return NO;
}

Value of the url at the moment when this method is called is similar to this one: com.myapp.payments://onetouch/v1/success?ba_token=BA-HERMES-SANDBOX-TOKEN

Did someone experience similar problem and how did you overcome it?

1 个答案:

答案 0 :(得分:0)

我在Braintree工作。

确保浏览器开关在iOS9上运行需要几个步骤。

1)确保您已添加所需的方案:https://developers.braintreepayments.com/guides/client-sdk/ios/v4#paypal-and-venmo-url-schemes

2)确保正确设置委托协议以呈现SFSafariViewController:https://developers.braintreepayments.com/guides/paypal/client-side/ios/v4#implementing-delegate-protocols