I am running into problems with the contacts api I believe from lack of memory. There are two steps to creating a TableView of records 1. create the array 2.Sort the array. This works in the Interpreter, android and iPHONE devices. But there is a problem with sort. It looks like if there are more than 70 contacts on the iPHONE, screen just goes dark. No error, but its running out of memory or timing out.
This is the code:
var people = Titanium.Contacts.getAllPeople(); //will try to sort the rows by last name function peopleSortByLastName(a, b) { var x = a.lastName.toLowerCase(); var y = b.lastName.toLowerCase(); return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }; //people.sort(peopleSortByLastName); //the sort routine is commented out because it goes blank when there are to many contact records returned. No errors.
Ideally, I would like to get an array of contacts presorted by lastName. Something that would look like: var people = Titanium.Contacts.getAllPeople(sortByLastName);
THe function above works if there are less than 30 contacts on an iPHONE. Perhaps there is an alternative solution?
Your Answer
Think you can help? Login to answer this question!