2011-04-07 98 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對象訪問它。

您首先需要獲取該多值屬性,然後使用此屬性可以訪問街道,城市和其他地址屬性。