Get contact details to titanium from native iOS contact app

浪子不回头ぞ 提交于 2019-12-08 02:45:42

It seems that you're missing a declaration of function to be called when a person is selected:

Titanium.Contacts.showContacts({/*missing selectedPerson callback object*/});

You can read more on what parameters can be passed into showContacts method here.

Finally I got it.

I used the following code:

button.addEventListener('click',function(e){
    Titanium.Contacts.showContacts(values);
});
var values = {cancel:function(){}};
values.fields = ['firstName', 'lastName', 'phone'];

values.selectedProperty = function(e) {
                var cn = e.person.firstName; 
                var sn = e.person.lastName;
                alert('Name'+cn+' '+sn);
};

Reference : Titanium Contacts

var parms = {
animated : true,
selectedPerson : function(e) {
    alert(e.person);
}

}; Titanium.Contacts.showContacts(parms);

You will get the details of selected person in e.person object. that can be passed to app.js etc according to your requirements. i just showed it in the alert.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!