Question

ABAddressBook mybook = new ABAddressBook();
ABPerson[] allPeople =  mybook.GetPeople();
foreach(ABPerson thisPerson in allPeople){

      if(thisPerson.GetPhones() != null)
             ABMultiValue<string> myMultiPhone = thisPerson.GetPhones();

      }
}

I have the previous code in my application. With Monotouch build 1.4 my application errors out. If there is no phone number associated with a contact, I get a null error. Does anyone have any idea how to check for null?

Was it helpful?

Solution

I ended up putting the code in a try catch. Oh well, it works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top