1
votes

I struggling to implement a Captuvo static library as a plugin in NativeScript.

Plugin structure:

nativescript-captuvo-scan
    ├── package.json
    └── platforms
        └── ios
            └── include
                ├── captuvo
                │    ├── Captuvo.h
                │    └── module.modulemap
                │       
                └── libCaptuvoSDK.a

After adding the nativescript-captuvo-scan plugin to my project I am running the following commands in an attempt to expose the library as typescript typings.

$ TNS_DEBUG_METADATA_PATH="$(pwd)/metadata" tns build ios

and

$ TNS_TYPESCRIPT_DECLARATIONS_PATH="$(pwd)/typings" tns build ios

Lots of d.ts files are generated in the project but I can't find a file exposing the library.

What am I missing, or where am I going wrong?

Does anyone know of a nativescript-plugin that wraps a static library? I can't seem to find an example out there that doesn't use a Podfile.

1
I think I know what's wrong. Trevor and I are emailing on this subject and will update this post once we're happy with the result. - Eddy Verbruggen
Turns out my manager discovered that we need to work with a different scanner that has keyboard wedge capabilities. I am putting a hold on my/our efforts for now. - Trevor
No problemo! In the meanwhile I figured out what the problem was. I'll share it below as an answer so others may benefit. - Eddy Verbruggen

1 Answers

2
votes

The folder structure is very important, but also the filenames. If you do it exactly like this, then NativeScript will correctly pick up your static iOS library:

folder structure

That CaptuvoSDK.d.ts is just a bonus: I generated TypeScript bindings for the Captuvo SDK by running these commands in the app's root folder:

  • TNS_DEBUG_METADATA_PATH="$(pwd)/metadata" tns build ios
  • TNS_TYPESCRIPT_DECLARATIONS_PATH="$(pwd)/typings" tns build ios