开发者

Monotouch ABAdressBook GetPhones Check For Null

开发者 https://www.devze.com 2022-12-15 05:37 出处:网络
ABAddressBook mybook = new ABAddressBook(); ABPerson[] allPeople =mybook.GetPeople(); foreach(ABPerson thisPerson in allPeople){
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 anyo开发者_Python百科ne have any idea how to check for null?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消