1
我已經能夠從地址簿api中檢索諸如名字,姓氏等屬性,但是我還沒有能夠解讀關於檢索實際地址的文檔。如果有人可以幫助,那將不勝感激。如何從iPhone的地址簿中檢索地址。
與該問題一起,該地址的屬性只有一個「街道」,但它支持多條街道(即streetaddress1,streetaddress2)。這是如何處理的?
我已經能夠從地址簿api中檢索諸如名字,姓氏等屬性,但是我還沒有能夠解讀關於檢索實際地址的文檔。如果有人可以幫助,那將不勝感激。如何從iPhone的地址簿中檢索地址。
與該問題一起,該地址的屬性只有一個「街道」,但它支持多條街道(即streetaddress1,streetaddress2)。這是如何處理的?
看看here,看看「地址屬性」部分。
你會發現:
const ABPropertyID kABPersonAddressProperty;
const CFStringRef kABPersonAddressStreetKey;
const CFStringRef kABPersonAddressCityKey;
const CFStringRef kABPersonAddressStateKey;
const CFStringRef kABPersonAddressZIPKey;
const CFStringRef kABPersonAddressCountryKey;
const CFStringRef kABPersonAddressCountryCodeKey;
我假設你已經用下面的代碼檢索記錄名字:
NSString *firstName = (NSString*)ABRecordCopyValue(record, kABPersonFirstNameProperty);
得到他們的城市,這樣做:
NSString *cityName = (NSString*)ABRecordCopyValue(record, kABPersonAddressCityKey);
其餘可以找到類似!