stripe / stripe-ios

Stripe iOS SDK
https://stripe.com
MIT License
2.09k stars 976 forks source link

My project hooks viewDidoad, viewWillAppear, Stripe also hooks, when I push or present STPPaymentOptionsViewController which lead to crash as follow: #1711

Closed janlionly closed 3 years ago

janlionly commented 3 years ago

Crash Info: -[STPPaymentOptionsViewController viewDidLoad]: unrecognized selector sent to instance

Crash here:(crash place using "------>" pointed out) // After hooks. STPAspectInvoke(classContainer.afterAspects, info, &aspectsToRemove); STPAspectInvoke(objectContainer.afterAspects, info, &aspectsToRemove);

// If no hooks are installed, call original implementation (usually to throw an exception)
if (!respondsToAlias) {
    invocation.selector = originalSelector;
    SEL originalForwardInvocationSEL = NSSelectorFromString(STPAspectsForwardInvocationSelectorName);
    if ([self respondsToSelector:originalForwardInvocationSEL]) {
        ((void( *)(id, SEL, NSInvocation *))objc_msgSend)(self, originalForwardInvocationSEL, invocation);
    }else {
  ------>    [self doesNotRecognizeSelector:invocation.selector];
    }
}

// Remove any hooks that are queued for deregistration.
[aspectsToRemove makeObjectsPerformSelector:@selector(remove)];

Summary

Code to reproduce

iOS version

Installation method

SDK version

Other information

janlionly commented 3 years ago

I don't want to remove my hooks, Any way to fix it?