2011-04-07 141 views
0

名字,姓氏和电子邮件地址很好用!只要我得到解决,即时通讯崩溃。为什么我在这里崩溃?

  NSString *firstName =  (NSString *)ABRecordCopyValue(thisPerson, kABPersonFirstNameProperty); 
      NSString *lastName =  (NSString *)ABRecordCopyValue(thisPerson, kABPersonLastNameProperty); 
      NSString *emailAddress = (NSString *)ABRecordCopyValue(thisPerson, kABPersonEmailProperty); 
      NSString *address =  (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressStreetKey); 
      NSString *city  =  (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressCityKey); 
      NSString *state  =  (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressStreetKey); 
      NSString *zip  =  (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressZIPKey); 
+0

你可以给它更多的背景吗?我希望问题在别的地方。 – Eiko 2011-04-07 19:45:45

回答

2

地址是多值属性((a multivalue property of type kABMultiDictionaryPropertyType),你不能像这样直接使用ABRecordRef对象访问它。

您首先需要获取该多值属性,然后使用此属性可以访问街道,城市和其他地址属性。