Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

showContacts crashes on device only?

I'm using the latest continuous builds to add a contacts picker to iPhone. Using the documentation & this [lighthoust ticket][ticket] I have it working in the simulator, but it is crashing on the device no matter what contact I choose. Any ideas?

    btnContacts.addEventListener('click', function(e) {
        var values = {
            cancel: function () { },
            animated: true,
            selectedPerson: function (e) {
                var email = '';
                var phone = '';        

                if (e.person.email != undefined) {
                    var emailTypes = ['home', 'work', 'other'];
                    for (var emailIndex = 0, emailLen = emailTypes.length; emailIndex < emailLen; emailIndex++) {
                        if (e.person.email[emailTypes[emailIndex]] != undefined && e.person.email[emailTypes[emailIndex]].length > 0) {
                            email = e.person.email[emailTypes[emailIndex]][0];
                            break;
                        }                        
                    }
                }        

                tfFirstName.value = isEmptyStr(e.person.firstName) ? '' : e.person.firstName;
                tfLastName.value = isEmptyStr(e.person.lastName) ? '' : e.person.lastName;
                tfEmail.value = isEmptyStr(email) ? '' : email;
            }
        };

        Titanium.Contacts.showContacts(values);

[ticket] : https://appcelerator.lighthouseapp.com/projects/32238/tickets/1001

— asked July 26th 2010 by Mike Robinson
  • contacts
  • iphone
  • showcontacts
1 Comment
  • Now that I'm trying another method, Titanium.Contacts.getAllPeople(), I'm still getting this error but only when I try to get an e-mail/phone. What am I doing wrong with the contacts?

    — commented July 27th 2010 by Mike Robinson

2 Answers

  • Has this been fixed? Is there a publicly accessible workaround?

    — answered June 2nd 2011 by Will Warren
    permalink
    0 Comments
  • Still having this issue, latest continuous build, even without custom labels. Please advise, I cannot use the contacts being as I have the issue with getAllPeople() as well.

    Also, wrapping the code in a try catch doesn't stop the app from crashing on the device.

    — answered August 19th 2010 by Mike Robinson
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.