1

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.

Trevor
  • 16,080
  • 9
  • 52
  • 83
  • 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 Apr 19 '17 at 08:33
  • 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 Apr 20 '17 at 16:34
  • 1
    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 Apr 20 '17 at 17:04

1 Answers1

2

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
Eddy Verbruggen
  • 3,550
  • 1
  • 15
  • 27
  • Ahh! Thanks for sharing! – Trevor Apr 20 '17 at 19:49
  • I have faced similar kind of problem and struggling to find the issue. If anyone have some idea pls share. https://stackoverflow.com/questions/49107273/create-nativescript-plugin-using-ios-static-library-issue – smartsanja Mar 05 '18 at 11:33