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


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

        

Reply via email to