Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1001] Contact Picker

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:54:55.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.4.0
ComponentsAndroid
Labelsandroid, contacts, defect, ios, iphone, phone, picker
Reporterctredway
AssigneeDon Thorp
Created2011-04-15T02:41:13.000+0000
Updated2011-04-17T01:54:55.000+0000

Description

If any phone number other than the first one is clicked, the app crashes. code below.

Titanium.Contacts.showContactPicker({
success:function(event){
Ti.API.log(event);
//var phonenr=event.contact.phone[0].value; //This crashes if I pick the not-first phone number for the contact. //var org=event.contact.organization; //This crashes }, details:['firstName','lastName','phone','organization']
});

After some testing I do not see an index of which number was clicked. I think its only looking for the first number in the contacts info although when a number is clicked, you can get to all the numbers for that contact but you do not know which one was clicked.

Comments

  1. Stephen Tramer 2011-04-15

    This code is for the old contacts module. Contacts has been rewritten, I will attempt to rewrite the given example for the new framework and see if it works. Multivalue properties did not work at all in the old contacts code.

  2. Stephen Tramer 2011-04-15

    The following is the correct way to obtain property information from the contact picker. See the Contacts documentation.

       
       // Way 1
       Titanium.Contacts.showContacts({
       selectedPerson: function(e) {
           var person = e.person;
           var emails = person.email;
           Ti.API.log(emails); // Display the multivalue format, or...
           for (var label in emails) {
               var emailList = emails[label];
               Ti.API.log(label + ": "+emailList);
           }
       }
       });
       
       // Way 2
       Titanium.Contacts.showContacts({
       selectedProperty: function(e) {
           if (e.property == 'email') {
               Ti.API.log(e.label + ": " + e.value);
           }
       }
       });
       
  3. Jeff Haynie 2011-04-15

    (from [312e90a78aabe995241fda4530c5bf9cc582a98f]) Closes #1001: Documentation changes for Contacts. http://github.com/appcelerator/titanium_mobile/commit/312e90a78aabe995241fda4530c5bf9cc582a98f"> http://github.com/appcelerator/titanium_mobile/commit/312e90a78aabe...

  4. vincent youmans 2011-04-15

    instead of returning the email, can I return a specific Phone number?
    phone is an array, and not sure how you would select an array item using your method.

JSON Source