如何添加iOS本机库并在nativescript上使用它?

时间:2018-11-20 09:46:57

标签: nativescript

我正在尝试将iOS本机库Jumio添加到我的本机脚本项目中。我遵循nativescript document的指示。如它所说,我做了这些步骤:

1-创建cli项目:

tns create MYCocoaPodsApp
cd MYCocoaPodsApp
tns platform add ios

2-将库包装为NativeScript插件

cd ..
mkdir my-plugin
cd my-plugin

3-在my-plugin内创建具有以下内容的package.json

{
  "name": "my-plugin",
  "version": "0.0.1",
  "nativescript": {
    "platforms": {
      "ios": "1.3.0"
    }
  }
}

4-在my-plugin/platforms/ios/Podfile文件内部创建一个Podfile,内容如下(我是从the native library document复制过来的):

source 'https://github.com/CocoaPods/Specs.git'

use_frameworks! # Required for proper framework handling

pod 'JumioMobileSDK', '~>2.13' # If you use BAM Checkout along Netverify in your app. Frameworks supporting device architectures only.

pod 'JumioMobileSDK/Netverify', '~>2.13' # Specify Netverify as subspec to only use Netverify, Fastfill or Document Verification
pod 'JumioMobileSDK/BAMCheckout', '~>2.13' # Specify BAMCheckout as subspec to only use BAM Checkout

看起来像这样

my-plugin/
├── package.json
└── platforms/
    └── ios/
        └── Podfile

5-安装和构建项目

tns plugin add ../my-plugin
tns build ios

它将成功安装和构建,但是我不知道该如何在项目中使用它。

有什么想法吗?

0 个答案:

没有答案