首页 > 解决方案 > Ionic 4 Cordova 联系人插件在 PWA 中不起作用

问题描述

Ionic 4 Cordova 联系人插件在 PWA 中不起作用

ionic cordova plugin add cordova-plugin-contacts
npm install @ionic-native/contacts

public contacts: Contacts

const contactsList = this.contacts.find(['*']);
        if (contactsList !== undefined) {
          contactsList.then(function(value) {

              self.everybody = value;
              // do print
              self.everybodyDuplicate = self.everybody;
              self.everybody = self.everybody.sort(function (a, b) {
                  var x =a.name.givenName;
                  var y =b.name.givenName;
                  if (x < y) return -1;
                  else if (x > y) return 1;
                  return 0;
              });
          });
        }

有一些错误:

ERROR 错误:未捕获(承诺中):TypeError:navigator.contacts.find 不是函数

标签: angularionic-frameworkionic4progressive-web-apps

解决方案


推荐阅读