等待中,我也是遇到华为的问题,不知道其他手机是否也有这个问题。如下代码,仅仅获取10条记录,花了20多秒;获取contacts.length,也是几十秒。
document.addEventListener("plusready", function() {}, false);
function find() {
plus.contacts.getAddressBook(
plus.contacts.ADDRESSBOOK_PHONE,
function(addressbook) {
contactStr = '';
addressbook.find(
["displayName", "phoneNumbers"],
function(contacts) {
//length = contacts.length;
for (var i=0;i<10;i++) {
try {
contactStr += contacts[i].displayName + "|"+contacts[i].phoneNumbers[0].value+";";
} catch (e) {
continue;
}
};
document.getElementById('acc').innerHTML = contactStr;
},
function() {
alert("error");
}, {
multiple: true
});
},
function(e) {
alert("Get address book failed: " + e.message);
});
}