You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Jesse MacFadyen (Resolved) (JIRA)" <ji...@apache.org> on 2012/01/13 02:17:39 UTC

[jira] [Resolved] (CB-157) Contacts API: contacts.find returns an array of unparsed contacts in JSON

     [ https://issues.apache.org/jira/browse/CB-157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse MacFadyen resolved CB-157.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4.0

Branch: refs/heads/master
Commit: 7e169b367fdab52960060239b071d52d83c3508e
Parents: ff02a04
                
> Contacts API: contacts.find returns an array of unparsed contacts in JSON
> -------------------------------------------------------------------------
>
>                 Key: CB-157
>                 URL: https://issues.apache.org/jira/browse/CB-157
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: WP7
>    Affects Versions: 1.3.0
>            Reporter: Abu Obeida Bakhach
>            Assignee: Jesse MacFadyen
>            Priority: Critical
>              Labels: features
>             Fix For: 1.4.0
>
>
> This code is supposed to work:
>   var options = new ContactFindOptions();
>   options.multiple = true;
>   navigator.contacts.find(["displayName"], onSuccess, onError, options);
>   function onSuccess(contacts) {
>       for (var i = 0; i < contacts.length; i++) {
>           console.log(contacts[i].displayName);
>       }
>   }
> But it doesn't. You have to call JSON.parse on each contact to convert it into a JavaScript object:
>   var options = new ContactFindOptions();
>   options.multiple = true;
>   navigator.contacts.find(["displayName"], onSuccess, onError, options);
>   function onSuccess(contacts) {
>       for (var i = 0; i < contacts.length; i++) {
>           var contact = JSON.parse(contacts[i]);
>           console.log(contact.displayName);
>       }
>   }

--
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