Search code examples
iosnativescripttelerik-appbuilder

Nativescript with AppBuilder plugin update


I am developing an app using nativescript with AppBuilder and Visual Studio. I am using a plugin called nativescript-pdf-view (https://github.com/Merott/nativescript-pdf-view). Everything worked fine until Apple changed one of their methods in xCode 8. See http://fluentreports.com/blog/?p=401 for details.

I have submitted a question to the author of the plugin 5 days ago, but have not received an answer yet, so I decided to make the change in the plugin code myself. The change is very simple, but after the update when I load the app to my test device, I still get the same error.

My question is: How does AppBuilder build plugins? Is it enough to update source code of the plugin to update it? How can I force the AppBuilder to rebuild this plugin?

I have a feeling the the plugin is cached somewhere because I get the same error message and stack trace even though the source code is changed.

Any suggestions are greatly appreciated.


Solution

  • In order to use a custom plugin in your project you have to update the reference in your package.json. For example in your case, you can:

    • Get the source code of nativescript-pdf-view.
    • Fix the issue you've noticed.
    • Build a .tgz from your modified source code (npm pack command should help you to create a .tgz).
    • Include the .tgz in your project (for example at the root level, right next to package.json).
    • Reference the .tgz in your package.json, so instead of having "nativescript-pdf-view": "1.0.0", you should have "nativescript-pdf-view": "file:nativescrip-pdf-view.tgz".
    • Build your project.

    This way the custom plugin will be used instead of the one from npm. There's no caching of plugins in the cloud builds. The process uses your package.json to install required dependencies.