1

我们正在尝试为 CardIO www.card.io) CardIO(5.4.1) 创建一个 nativescript 插件(IOS):

  1. 下载了 nativescript-plugin-seed ( https://github.com/NathanWalker/nativescript-plugin-seed )
  2. 执行种子的所有预请求。
  3. 在平台中添加了 podFile (pod 'CardIO', :git=> ' https://github.com/card-io/card.io-iOS-SDK.git ')
  4. 修改 CardIO.ios.ts 以调用 CardIO 库中的函数

Pod 下载良好。当我们检查 XCODE 项目时,添加了 Cardio pod,并添加了库和 *.h 文件。

当我们运行项目时,我们无法调用 CardIO 库中的任何函数。我们假设库中的所有函数都没有为 javascript 公开。

JavaScript 错误:

file:///app/tns_modules/nativescript-cardio/cardio.js:3:57:JS 错误 ReferenceError:找不到变量:CardIOPaymentViewController

请在 heart.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);
    }
}
4

1 回答 1

1

我今天对此进行了调查,不得不得出结论 CardIO 目前与 NativeScript 不兼容。它不会经常发生,但有时会发生。

好消息是您可以获取 Podfile 的资产并自己创建一个(在这种情况下)静态框架,可以很好地暴露给 NativeScript。

在这种情况下,尽管还有一些挑战(例如,三个 .a 文件而不是一个文件)。

在这里解释有点太多(程序和代码),所以我宁愿在 GitHub 存储库中添加一些代码并从这个问题链接到该代码。

如果您需要我的帮助,能否给我发邮件(gmail dot com 的 eddyverbruggen)?

于 2017-04-25T19:23:02.590 回答