2017-04-25 32 views
1

我们正在尝试为CardIO创建nativescript插件(IOS)www.card.io) CardIO(5.4.1) :用于CardIO的Nativescript插件(IOS) - 无法调用CARDIO库中的任何函数并且未公开

  1. 下载nativescript-插件种子(https://github.com/NathanWalker/nativescript-plugin-seed
  2. 执行的所有预requesties的种子。
  3. 新增podFile在平台(POD '心',:git的=> 'https://github.com/card-io/card.io-iOS-SDK.git')
  4. 修改CardIO.ios.ts调用函数的心库

荚是越来越好下载中。当我们检查XCODE项目时,Cardio pod被添加,并且库和* .h文件被添加为GOOD。

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

JavaScript错误:

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

请找到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); 
    } 
} 
+1

请提供一些代码,以便更好地了解您的问题 – bisma

回答

1

代码我看着这个今天已经结束的心是不是目前NativeScript兼容。它不经常发生,但有时它确实发生。

好消息是,您可以获取Podfile的资产并创建一个(本例中)静态框架,您可以将它们暴露给NativeScript。

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

这里有点太多了(程序和代码)来解释这里,所以我宁愿添加一些代码到GitHub仓库,并链接到这个问题。

如果您需要我的帮助,您可以给我发邮件(eddyverbruggen at gmail dot com)吗?

+0

我已发送电子邮件至[email protected]。谢谢你的帮助。 – gjai

+0

嗨Eddy,NativeScript 3.3中仍然如此吗? 3.1似乎是一个很大的改变,但我不知道它是否影响了这种兼容性。 – Aaron

相关问题