1

We are trying to create a nativescript plugin(IOS) for CardIO www.card.io) CardIO(5.4.1):

  1. downloaded nativescript-plugin-seed (https://github.com/NathanWalker/nativescript-plugin-seed)
  2. Performed all pre-requesties for the seed.
  3. Added podFile in platform (pod 'CardIO', :git=> 'https://github.com/card-io/card.io-iOS-SDK.git')
  4. Modified CardIO.ios.ts to call the functions in the CardIO Library

The Pod is getting downloaded good. When we checked the XCODE project the Cardio pod is added and the library and *.h files are added GOOD.

When we run the project we are not able to call any of the functions in the CardIO library. We assume that none of the functions in the library is exposed for javascript.

JavaScript error:

file:///app/tns_modules/nativescript-cardio/cardio.js:3:57: JS ERROR ReferenceError: Can't find variable: CardIOPaymentViewController

Please find the code in cardio.ios.ts

export var scanCardClicked = function () {
  // var CardIOPaymentViewController=new CardIOPaymentViewController();
    let scanViewController = CardIOPaymentViewController.alloc().initWithPaymentDelegate(this);
    scanViewController.modalPresentationStyle = UIModalPresentationFormSheet;
    this.presentViewControllerAnimatedCompletion(scanViewController, 1, null);
}
class CardIOPaymentViewControllerDelegateImpl extends NSObject implements CardIOPaymentViewControllerDelegate {
  userDidProvideCreditCardInfoInPaymentViewController(info: CardIOCreditCardInfo, paymentViewController: CardIOPaymentViewController)
   {this.dismissViewControllerAnimatedCompletion(1, null);
    //this.infoLabel.test = "Received Card: " + info.redactedCardNumber + "Expiry:" + info.expiryMonth + "/" + info.expiryYear + "CVV:" + info.cvv;
    }
    userDidCancelPaymentViewController(paymentViewController: CardIOPaymentViewController)
     {
        this.dismissViewControllerAnimatedCompletion(1, null);
    }
}
Bertrand Martel
  • 42,756
  • 16
  • 135
  • 159
gjai
  • 11
  • 2

1 Answers1

1

I looked into this today and had to conclude the CardIO is not currently NativeScript compatible. It doesn't happen often but sometimes it does.

The good news is that you can take the assets of the Podfile and create a (in this case) static framework yourself that can be exposed to NativeScript just fine.

In this case though there's a few more challenges (three .a files instead of just one, for instance).

It's a bit too much (procedures and code) to explain here so I'd rather add some code to a GitHub repo and link to that from this issue.

Can you please mail me (eddyverbruggen at gmail dot com) if you want my assistance?

Eddy Verbruggen
  • 3,550
  • 1
  • 15
  • 27
  • I have sent an email to eddyverbruggen@gmail.com. Thanks for your help. – gjai Apr 27 '17 at 09:36
  • Hi Eddy, is this still the case in NativeScript 3.3? 3.1 seems like it was a big change, but I don't know if it affected this kind of compatibility. – Aaron Oct 27 '17 at 15:40