0

I am adding PayPal to my app but the PaymentViewController won't work. I import the following in my bridging header:

      #import "PayPalMobile.h"
      #import "PayPalConfiguration.h"
  #import "PayPalPaymentViewController.h"
  @interface ViewController : UIViewController<PayPalPaymentDelegate>
   @end
  #endif /* Header_h */

And my paymentviewcontroller is:

   let paymentViewController = PayPalPaymentViewController(payment: payment, configuration: payPalConfig, delegate: self)

And my error is "MyClass does not conform to protocol PayPalPaymentDelegate"

gareth power
  • 209
  • 2
  • 4
  • 12

1 Answers1

1

Implement the following methods in your view controller:

// PayPalPaymentDelegate

func payPalPaymentDidCancel(paymentViewController: PayPalPaymentViewController) {

  }

  func payPalPaymentViewController(paymentViewController: PayPalPaymentViewController, didCompletePayment completedPayment: PayPalPayment) {



  }
Bhagyalaxmi Poojary
  • 1,213
  • 1
  • 12
  • 17
  • Thanks, that solved one error, but now I get: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController payer:]: unrecognized selector sent to instance 0x7fdb33824000 – gareth power Jun 10 '16 at 12:50
  • One of your UI element is not associated with function and you are trying to access the UI element... Check your UI elements are properly bound to function calls. – Bhagyalaxmi Poojary Jun 10 '16 at 12:52
  • Thanks again for the help, but how do you mean Bhagyalaxmi Poojary? – gareth power Jun 10 '16 at 12:58
  • This may help you - http://stackoverflow.com/questions/24153058/ios-unrecognized-selector-sent-to-instance-in-swift.. If you dont mind, rate up my answer :) – Bhagyalaxmi Poojary Jun 10 '16 at 12:59