如何使用phonegap在iPhone中保存联系人以及地址、组织和类别

发布于 2024-12-07 08:19:35 字数 553 浏览 0 评论 0原文

任何人都可以帮助我..

var 地址 = [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 的代码。但地址未添加到地址簿中,其余如姓名、电话号码已正确更新。

期待解决方案。

Anyone help me..

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; 

Above is the code i am trying to add contact address to iOS using Phonegap. But the address not added to Addressbook, rest like Name, phonenumbers are updated properly.

Looking forward to the solution.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

从来不烧饼 2024-12-14 08:19:35

在 PhoneGap 中,地址数组包含多个地址,而不是多个地址详细信息。
要添加您的地址,请尝试:

addresses[0] = new ContactAddress();
addresses[0].streetAddress = 'yourStreet';
addresses[0].locality = 'yourLocality';
addresses[0].postalCode = 'yourPostalCode';
addresses[0].country = 'yourCountry';

In PhoneGap, the addresses array contains several addresses, not several address-details.
To add your address, try :

addresses[0] = new ContactAddress();
addresses[0].streetAddress = 'yourStreet';
addresses[0].locality = 'yourLocality';
addresses[0].postalCode = 'yourPostalCode';
addresses[0].country = 'yourCountry';
跨年 2024-12-14 08:19:35

试试这个:

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;

Try This:

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;
意中人 2024-12-14 08:19:35

谢谢维纳亚克。
我得到了解决方案,问题是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; 

Thanks Vinayak.
I got the solution, problem with iOS not phonegap and below is the working code.The type property required for adding contactAddress in iOS addressbook.

                    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; 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文