diff --git a/BraintreePaymentFlow/BTPaymentFlowDriver.m b/BraintreePaymentFlow/BTPaymentFlowDriver.m index 3a922eed29..ee6fca5bdc 100644 --- a/BraintreePaymentFlow/BTPaymentFlowDriver.m +++ b/BraintreePaymentFlow/BTPaymentFlowDriver.m @@ -121,8 +121,14 @@ - (void)informDelegatePresentingViewControllerRequestPresent:(NSURL *)appSwitchU - (void)informDelegatePresentingViewControllerNeedsDismissal { if (self.viewControllerPresentingDelegate != nil && [self.viewControllerPresentingDelegate respondsToSelector:@selector(paymentDriver:requestsDismissalOfViewController:)]) { - [self.viewControllerPresentingDelegate paymentDriver:self requestsDismissalOfViewController:self.safariViewController]; - self.safariViewController = nil; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + if (@available(iOS 9.0, *)) { +#endif + [self.viewControllerPresentingDelegate paymentDriver:self requestsDismissalOfViewController:self.safariViewController]; + self.safariViewController = nil; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + } +#endif } else { [[BTLogger sharedLogger] critical:@"Unable to dismiss View Controller to end payment flow. BTPaymentFlowDriver needs a viewControllerPresentingDelegate to be set."]; } @@ -140,10 +146,15 @@ + (BOOL)canHandleAppSwitchReturnURL:(NSURL *)url sourceApplication:(NSString *)s - (void)handleOpenURL:(NSURL *)url { [self.apiClient sendAnalyticsEvent:[NSString stringWithFormat:@"ios.%@.webswitch.succeeded", [self.paymentFlowRequestDelegate paymentFlowName]]]; - if (self.safariViewController) { - [self informDelegatePresentingViewControllerNeedsDismissal]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + if (@available(iOS 9.0, *)) { +#endif + if (self.safariViewController) { + [self informDelegatePresentingViewControllerNeedsDismissal]; + } +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 } - +#endif [self.paymentFlowRequestDelegate handleOpenURL:url]; }