0
votes

I have installed cordova 3.0.0 and created a helloworld project, and installed cordova-plugin-contacts. cordova create Helloworld com.example.helloworld "Helloworld" cd Helloworld cordova platforms add ios cordova build cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts.git

and trying to call navigator.contacts.chooseContact

function contactChooser(){
    var options = new ContactFindOptions();
    options.fields = ["displayName", "name", "emails", "phoneNumbers"];
    navigator.contacts.chooseContact( onSuccess, options);
}

but getting this error on safari web inspector.

1
I am not sure how Cordova works but what is the console log for navigator.contacts ? That should show if chooseContact is exposed/available.techiev2
as the title says it is undefined.enRaiser
IF I Include plugins/org.apache.cordova.core.contacts/www/ios/contacts.js then I am able to get rid of this issue. but then a new problem comes that it say undefined for other function at line 57 of contacts.js , and says create is undefined var fullContact = require('./contacts').create(result);enRaiser

1 Answers

0
votes

I found that there is a bug in cordova 3.0.0 ,( i raised ) the namespace were clashing for org.apache.cordova.core.contacts.cotancts

The proper solution to this is as follow Edit org.apache.cordova.core.contacts/plugin.xml and replace contacts to contactxxx as follow

    <js-module src="www/ios/contacts.js" name="contacts_ios">
        <merges target="navigator.contacts" />
    </js-module>

    <js-module src="www/ios/Contact.js" name="Contact_ios">
        <merges target="Contact" />
    </js-module>

and all problem gone

I have raised this bug at https://issues.apache.org/jira/browse/CB-4599 , let us see if they have better solution.