Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.1.0
-
None
-
iOS
Description
This was brought to my attention when the InAppPurchaseManager plugin no longer worked for me on 2.1.0rc2, but was working in 2.0.
The issue happens when calling cordova.exec using "FORMAT TWO", e.g:
cordova.exec('InAppPurchaseManager.requestProductData', productId, callback + '.success', callback + '.fail');
When the arguments get to the native side there is an extra null value preceding the rest of the arguments. This is only a problem when the plugin expects the arguments to be in a certain order, like for InAppPurchaseManager. A workaround for InAppPurchaseManager is to increase the index by one for each call in the .m file (e.g. [arguments objectAtIndex:0] becomes [arguments objectAtIndex:1]).
The extra null value is the callbackId, which is always going to be null using "FORMAT 2". The code that handles this was refactored since 2.0, which may be the source of the problem, in particular around line 959 of the current cordova.js:
var command = [callbackId, service, action, actionArgs];