Upgrading custom iOS plugins from Cordoba 1.7 to 2.1, how can I find out why they are never loaded? - xcode

I've got my plugins converted, or so I think, and registered in Cordova.plist. The method signatures are correct, according to this guide. Nothing has changed on the js side, yet they don't load and just fail silently. Cordova itself is working, onDeviceReady is firing, but my plugins just never get executed. Everything worked fine with 1.7...
I'd like some help to get started on figuring out where they are supposed to be loaded and/or called from js on the obj-c side. Where can I set a breakpoint in the Cordova source to see why it's not executing my plugin?
Where should I begin to look?

I just did exactly this migration. All I can say is that it worked for me if you follow the steps. You also need to follow the steps from the 1.9>2.0 migration.

Since Cordova 2.0, the framework had big changes.
Maybe is better you implements again using the 2.0 rules and, after, only override selector signature. Thus you learn how do plugin in new versions, updating your Cordova skills. :)
Single big change between 2.0 and 2.1 (for plugins)
Support a new plugin method signature (old signature is deprecated):
The new signature is:
- (void) myMethod:(CDVInvokedUrlCommand*)command;
The old (deprecated) signature is:
- (void) myMethod:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;

Related

Migrating to NativeScript 7

I'm migrating a typescript/angular based NativeScript project over to the latest version of NativeScript, and am running into an issue. Before, I was using the tns-platform-declarations plugin (https://preview.npmjs.com/package/tns-platform-declarations) so I could get intellisense (I'm using VS Code) for things like UITextView and other native calls. But when updating my project, this module is removed from package.json. And if I add it back in, it says my project is not compatible with 7.x.
Do I just need to wait until the plugin is updated, or is there another way to get intellisense going, but still use NS 7.x?
Extending on Matthew's answer. Make sure you are including in your tsconfig the references.d.ts file, the one that points to either tns-platform-declarations or #nativescript/types, depending on your NativeScript version.
When you migrate the project it will change your tns-platform-declaration to #nativescript/types
https://nativescript.org/blog/nativescript-7-announcement/

Barcodescanner phonegap, cordova.plugins is undefined

Sounds familiar to what I found online, but I didn't get an answer to my case.
This is an Vue.js app, embedded in a cordova app, for Android.
I use Visual Studio Tools for Apache Cordova, and I installed plugins such as Camera, or phonegap's barcode scanner (installed in my project from their github).
I got Camera plugin to work, with navigator.camera.getPicture(callback).
It seems I should use phonegap's barcode scanner through cordova variable, with cordova.plugins, that's what is stated in their documentation, but this cordova.plugins is undefined.
People say plugins have to be accessed after the event deviceready fires, but even checking that, the event is indeed emitted, and just putting console.log(cordova.plugins) in the callback function, I get "undefined".
This is what I do
document.addEventListener("deviceready", () => {
console.log("The event is right !");
console.log(cordova);
console.log(cordova.plugins);
})
Everything is right except for the plugins (3rd log). cordova.plugins should be defined because I have some plugins that do use it, but it seems I'm doing something wrong... Maybe something about config.xml or package.json ?
They changed something in new versions of this plagin, so it works only in new versions of Cordova as far as I undestand. So, my solution is to use old version of the plugin temporary. For instance, in this version of the plugin cordova.plugins.barcodeScanner.scan is available from a code on my side:
https://github.com/phonegap/phonegap-plugin-barcodescanner.git#6.0.5
(you can see a version information at the end of this line)
Please let me know if you found better solution.

Joomla component upgrade with custom code

My client purchased a Joomla component, the comoponent need a customization in both front end and back end.
But his requirment is, custom code in front end and back end to be upgrded while upgrading original component.
Example : I bought a component from a company XYZ and the component name is joomla_events, current latest version is 2.0. I done the customization in the version 2.0. Later on the company releases new version 3.0, If the client upgrade the component from version2.0 to version 3.0 then the custom code in the version 2.0 also updated in version 3.0
Please help to do the custom code upgrade in Joomla component.
This is why editing core files is never recommended, because it gets overridden when updated and people then start to have problems.
A simple answer to your question is, you can't have the custom code you added into version 2.0 appear in version 3.0.
You will need to re-add the code you added before. Yes, it is pain taking and annoying, however you would have been better in the first place to develop a plugin which could have been used to extend the component and would make upgrading easy. Not only will you have to add your code again, but you will need to thoroughly test it to ensure it works.
check this may be it helps you....
http://docs.joomla.org/J2.5:Managing_Component_Updates_(Component_release_files)

Checking PhoneGap version in xCode

I have a problem with my phonegap-based project, and I'm suspecting I'm running a different version than I think. the config.xml file I'm using states it's 2.0.0, while I thought it's 2.9.
Is there a way to actually check the phonegap version in xcode, and not relay on a comment in a single file?
Thank you!
you can use device object's cordova(device.cordova) property to get the version of phonegap.
Below link provides more information for same.
http://docs.phonegap.com/en/3.0.0/cordova_device_device.md.html#Device
I thought I would add to #user1279357's answer, which demonstrates how to acquire the version of Cordova from the JavaScript side. However, on the Objective-C side, if you add #import <Cordova/CDVAvailability.h> you can call the constant: CORDOVA_VERSION_MIN_REQUIRED.
This constant is an int that will provide you with the version of Cordova you are using. The value is in the form of: 20000 = 2.0, 20800 = 2.8 e.t.c.
If you need to do checks against this value, there are other constants defined in this file for each of the versions, e.g. __CORDOVA_2_0_0 = 2.0.
Look here to see the source file for CDVAvailability.h.
Look in your cordova.js file at the top in the comments.
If you're using a really old version of cordova, it will be in the listed in the filename like "Cordova2.7.js"

Firefox Gecko SDK : NPP_GetValue not getting called

I have tried out the NPRuntime sample provided with the Gecko SDK 1.9.1 with the help of this link.
It works perfectly fine with Firefox 3.6.
Following the above steps I created a new scripting plugin (npmyplugin.dll). I am currently placing npmyplugin.dll in a folder other than Firefox/plugins. I am registering the associated mime-type and plugin path in the registry. The plugin gets loaded properly. But now the browser is not calling NPP_GetValue.
I was suspecting that it must be because I am placing the plugin in a directory other than Firefox/plugins. Hence I did the same with npruntime.dll (the sample which comes with Gecko sdk). Suprisingly npruntime.dll scripting was working. Please guide me whether I missing anything important while creating the new plugin.
NPP_GetValue doesn't get called to get the NPObject until the first time you access it with javascript in many cases. When you do a getElementById, it will make the call.
Likely other calls to GetValue are being made, but you aren't seeing them because you aren't handling them. However, that's still not guaranteed.
Sorry for replying so late. I somehow solved the problem. I was embedding the plugin using tag
then i wrote a small javascript code
var MyWorkingPlugin = document.getElementById('MyPlugin');
It seems that after executing the above javascript NPP_GetValue was called. Currently I have no convincing reason why it happened but it worked and I am happy for the moment. If anyone can explain the above behaviour please let us know.

Resources