Cordova Phonegap contacts.find Success第一次尝试时未触发-第二次尝试结果加倍

Cordova Phonegap contacts.find Success第一次尝试时未触发-第二次尝试结果加倍,cordova,phonegap-plugins,Cordova,Phonegap Plugins,我在PhoneGap 3.3.0(iOS,尚未在Android上测试)中遇到了一个奇怪的问题,当我执行联系人时,发现它没有触发成功或错误。一旦我第二次启动它,它就开始工作了,但是它会给我每个联系人输入两次 // Set the options for the contacts request var options = new ContactFindOptions(); options.filter = ""; option

我在PhoneGap 3.3.0(iOS,尚未在Android上测试)中遇到了一个奇怪的问题,当我执行联系人时,发现它没有触发成功或错误。一旦我第二次启动它,它就开始工作了,但是它会给我每个联系人输入两次

// Set the options for the contacts request
            var options = new ContactFindOptions();
            options.filter = "";
            options.multiple = true;

            filter = ["displayName", "name", "phoneNumbers", "emails", "photos"];

            // Getting the contacts
            navigator.contacts.find(filter, function(contacts){
                console.log(contacts);

                // If contacts were found:
                // For each contact result...
                contacts.forEach(function(item, index){
                    // Check to make sure they have a first or last name
                    if(item.name.givenName != null || item.name.familyName != null) {
                        // If that have a first or last name:
                        // Add the persons first and/or last name to the mycontacts array
                        mycontacts.pushObject((item.name.givenName != null ? item.name.givenName+" " : "")+(item.name.familyName != null ? item.name.familyName : ""));
                    }
                });

                console.log(mycontacts);

                // Mark "gotcontacts" as being done successfully to prevent unrequired calls
                that.set("gotcontacts", true);

                that.send('loaderOff');
            }, function(error){
                console.log("couldn't get contacts");
                // If there was an error getting the contacts
                alert("Sorry, we couldn't find any contacts.");

                that.send('loaderOff');
            }, options);
我按下按钮就会触发呼叫


如果有人知道为什么会这样,那就太好了。现在我迷路了

我也面临着几乎相同的问题。未从DeviceReady触发的成功事件仅从button click事件触发。你找到解决办法了吗?我当时找不到解决办法。最后,我使用了另一个插件。话虽如此,但我后来发现,如果你删除了phonegap平台上存在的问题,然后再添加它,它通常会解决插件相关的问题。