When I pass an objective-c protocol as a parameter, when and that delegate is then used to trigger one of its methods, the method does not fire.
I'm using the delegate from the Paypal iOS SDK defined as follows:
@protocol PayPalPaymentDelegate <NSObject>
    - (void)payPalPaymentDidCancel:(PayPalPaymentViewController *)paymentViewController;
@end
I have a UIViewController that implements the protocol:
//simpleviewcontroller.h
@interface SimpleViewController : UIViewController<PayPalPaymentDelegate>
and a method signature like the following:
// HelperFunctions.m
+ (void) doSomething: (id<PayPalPaymentDelegate>)paypalDelegate
{
    // the selector 'payPalPaymentDidCancel' DOES fire
    [paypalDelegate performSelector:@selector(payPalPaymentDidCancel:) withObject:self]
}
// called from simpleviewcontroller.m that implements PayPalPaymentDelegate
[HelperFunctions doSomething: self]
The problem is that when paypal returns the result, it does not trigger the delegate:
// code inside of the 'success' block of an AFNetworking call
PayPalPaymentViewController *paymentViewController;
paymentViewController = [[PayPalPaymentViewController alloc] initWithPayment:payment    
                                                             configuration:paypalConfiguration   
                                                             delegate:paypalDelegate];
The paypalDelegate passed to 'delegate' here is never triggered by paypal. Whereas it IS triggered if done from simpleviewcontroller.m and not via the method doSomething
Once you have created the paymentViewController are you keeping hold of the paypalDelegate somewhere? PayPalPaymentViewController only keeps a weak reference to the delegate so if not it will be being released (and therefore none of it's methods firing) by ARC at the end of the scope that creates the PayPalPaymentViewController.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With