2012-09-17 6 views
0

연락처에서 한 명 선택한 사람의 주소를 얻으려고 애 쓰고 있습니다. 나는 사람의 선택에 따라 이메일과 이름이 같은 데이터를 얻을 수 ABPeoplePickerNavigationController이 위임 방법을 사용하고주소록에서 여러 주소 가져 오기? (ABRecordRef)

:

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person

하지만 어떻게 사람 (또는 여러 주소의 주소를 얻을 수 있습니다 한 명 이상이 있어야합니까?) 각 주소를 개별적으로 가져와 주소 입력란 1, 2, 도시, 주, 우편 번호, 국가와 같은 부분으로 나누어야합니다.

도움을 주시면 감사하겠습니다.

답변

0

여기에 사람의 주소 속성을 가져 오는 방법. `그 충돌 응용 프로그램;`는 NSString * 거리 = (__bridge있는 NSString *) ABRecordCopyValue (사람, kABPersonAddressStreetKey) : 주소 속성 상수의

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *) 
      peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person 
      property:(ABPropertyID)property 
      identifier:(ABMultiValueIdentifier)identifier{ 

      NSString *string = (NSString*)ABRecordCopyValue(person, AddressPropertyHere); 
} 

목록 :

const ABPropertyID kABPersonAddressProperty; 
const CFStringRef kABPersonAddressStreetKey; 
const CFStringRef kABPersonAddressCityKey; 
const CFStringRef kABPersonAddressStateKey; 
const CFStringRef kABPersonAddressZIPKey; 
const CFStringRef kABPersonAddressCountryKey; 
const CFStringRef kABPersonAddressCountryCodeKey; 
+0

나는이 시도했다. 또한 다음과 같은 경고 메시지가 나타납니다 : 'const CFStringRef'(일명 'const struct __CFString * const')를 'ABPropertyID'(일명 'int') 유형의 매개 변수로 전달하는 정수 변환에 대한 호환되지 않는 포인터; '마지막으로, 하나의 연락처에 둘 이상의 주소가있는 경우 어떻게 여러 주소를 가져야합니까? –

+0

NSString 대신 int를 사용하십시오. – janusbalatbat