Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

In Ios not working #197

Closed
yomencity opened this issue Dec 1, 2018 · 2 comments
Closed

In Ios not working #197

yomencity opened this issue Dec 1, 2018 · 2 comments

Comments

@yomencity
Copy link

yomencity commented Dec 1, 2018

In android cordova-plugin-contacts works fine.
But In Ios this plugin does not work.
Following is my code.

  cordova.plugins.diagnostic.getContactsAuthorizationStatus(function(status){
    if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
    var rpnc=JSON.parse(window.localStorage['pb']);
    var pp=[];
    function onSuccess(contacts) {
      var ppl=contacts.length;    
      for(var i=0 ;i<ppl;i++){
        for(var j=0;j<contacts[i].phoneNumbers.length;j++){
          if(rpnc.indexOf('+82'+contacts[i].phoneNumbers[j].value.replace(/[^0-9]/g,'').substring(1))==-1){
            pp.push('+82'+contacts[i].phoneNumbers[j].value.replace(/[^0-9]/g,'').substring(1));  
          }      
        }
      }
      if(pp.length>0){
        p_change1(pp);  
        var rcp=rpnc.concat(pp);
        window.localStorage['pb']=JSON.stringify(rcp);          
      }else{
        p_change2();
      }    
    };
    function onError(contactError) {
        alert('onError!');
    };
    var options      = new ContactFindOptions();
    options.filter   = "";
    options.multiple = true;
    options.desiredFields = [navigator.contacts.fieldType.id,navigator.contacts.fieldType.displayName,navigator.contacts.fieldType.phoneNumbers];
    options.hasPhoneNumber = true;
    var fields       = [navigator.contacts.fieldType.displayName, navigator.contacts.fieldType.name];
    navigator.contacts.find(fields, onSuccess, onError, options);
    }else{
      alert('permission X');    
    }
  }, function(error){
    console.error("The following error occurred: "+error);
  });
@Bramzor
Copy link

Bramzor commented Dec 9, 2018

Provide at least an error...

@timbru31
Copy link
Member

timbru31 commented Jan 9, 2023

We are archiving this repository following Apache Cordova's Deprecation Policy. We will not continue to work on this repository. Therefore all issues and pull requests are being closed. Thanks for your contribution.

@timbru31 timbru31 closed this as completed Jan 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants