[MonoTouch] Problem with ABAddressBook on the Device

Peter Stockli petercs at gmail.com
Sat Oct 31 05:26:53 EDT 2009


Hello

I wrote following code to read out all Phonenumbers in the Addressbook of
the iPhone:

        public static List<string> getPhoneNumbers() {

            List<string> phoneList = new List<string>();

            ABAddressBook mab = new ABAddressBook();

            ABPerson[] mypeople = mab.GetPeople();
            ABMultiValue<string> myphones;
            string[] strpeople;
            for (int i = 0; i < mab.PeopleCount; i++) {
                myphones = mypeople[i].GetPhones();
                strpeople = myphones.GetValues();

                phoneList.AddRange(strpeople);

            }
            return phoneList;

        }

This works in the simulator, but crashes on the Device.

When I try to debug on the device with the new 1.2 Beta,
the app is killed before startup (most likely the 10 seconds rule)

Is there any sample code on how to properly accessing the addressbook
with monotouch?

Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20091031/13d0467b/attachment.html 


More information about the MonoTouch mailing list