任何人都帮助我..
var addresses = [4];
addresses[0] = new ContactAddress('streetAddress','Die Strasse 45',true);
addresses[1] = new ContactAddress('locality','Hamburg',true);
addresses[2] = new ContactAddress('postalCode','22041',true);
addresses[3] = new ContactAddress('country','Deutschland',true);
myContact.addresses = addresses;
以上是我尝试使用Phonegap向iOS添加联系地址的代码。但地址没有添加到地址簿,其余像名称,电话号码正确更新。
期待解决方案。
答案 0 :(得分:1)
在PhoneGap中,地址数组包含多个地址,而不是几个地址详细信息。 要添加您的地址,请尝试:
addresses[0] = new ContactAddress();
addresses[0].streetAddress = 'yourStreet';
addresses[0].locality = 'yourLocality';
addresses[0].postalCode = 'yourPostalCode';
addresses[0].country = 'yourCountry';
答案 1 :(得分:0)
试试这个:
var addresses = [1];
var address = new ContactAddress();
address.streetAddress='MyAddress';
address.locality='MyLocality';
address.postalCode='MyPostCode';
address.country='MyCountry';
addresses[0] = address;
contact.addresses = addresses;
答案 2 :(得分:0)
感谢Vinayak。 我得到了解决方案,iOS的问题不是phonegap,下面是工作代码。在iOS地址簿中添加contactAddress所需的类型属性。
var addresses= [];
addresses[0] = new ContactAddress();
**addresses[0].type = 'home';**
addresses[0].streetAddress = 'yourStreet';
addresses[0].locality = 'yourLocality';
addresses[0].postalCode = 'yourPostalCode';
addresses[0].country = 'yourCountry';
myContact.addresses = addresses;