You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Oleg Gryb (Commented) (JIRA)" <ji...@apache.org> on 2012/03/06 22:45:56 UTC

[jira] [Commented] (CB-255) iOS: a parameter with value 'null' is not passed to 'arguments' array

    [ https://issues.apache.org/jira/browse/CB-255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13223688#comment-13223688 ] 

Oleg Gryb commented on CB-255:
------------------------------

After looking to the Cordova branches suggested by Filip Maj: 

https://github.com/filmaj/incubator-cordova-js
https://github.com/filmaj/incubator-cordova-ios

I think that what we need to do is to simplify arguments processing in Cordova.exec function as follows:
    for (var i = 0; i < actionArgs.length; ++i) {
        var arg = actionArgs[i];
//        if (arg == undefined || arg == null) {
//        if (arg == undefined) {
//            continue;
//        } else if (typeof(arg) == 'object') {
//            command.options = arg;
//        } else {
            command.arguments.push(arg);
//        }
    }


It will lead to the following effects:

1. options collection will be always empty. Does anyone really care? Can we put all elements to 'arguments' just like in Android's case?
2. null parameter will be passed to 'arguments' as an NSNull object, which would be perfect in my view.

Please let me know you thoughts. I think, we still need to keep the 'withDict:(NSMutableDictionary *)options' parameter in iOS methods for backward compatibility.


                
> iOS: a parameter with value 'null' is not passed to 'arguments' array 
> ----------------------------------------------------------------------
>
>                 Key: CB-255
>                 URL: https://issues.apache.org/jira/browse/CB-255
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 1.4.0
>         Environment: iOS Mac OS X 10.7
>            Reporter: Oleg Gryb
>            Assignee: Shazron Abdullah
>             Fix For: 1.6.0
>
>
> In the following JS call the second parameter (null) will not be passed to 'arguments' array in a Objective-C controller.
> The 'arguments' array will contain only first ('1') and third ('3') parameters. 
>        
> return PhoneGap.exec(successCallback,
>                              failureCallback, 
>                              VPCLASS,  
>                              'method',
>                              [1, null, 3]);
> Hint: typeof(null) is equal to 'object' in JS. PhoneGap.js uses this check to determine if a parameter should go to 'arguments' or to 'options' collections. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira