incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Abu Obeida Bakhach (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-157) Contacts API: contacts.find returns an array of unparsed contacts in JSON
Date Thu, 05 Jan 2012 22:41:40 GMT
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

        

Mime
View raw message