开发者

How to save contact along with address, Organization and categoriesin iphone using phonegap

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.


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';


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;


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; 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜