2009-12-09 9 views
2

현재 peoplePickerNavigationController에 액세스하여 데이터를 가져올 수 있지만 연락처의 전자 메일 주소에 액세스하고 모달 창을 닫으면 해당 연락처가 닫히는 것이 좋습니다. 이름이 눌러졌습니다.iPhone 주소록에서 전자 메일 주소 받기

시나리오 :

"Button is clicked to add a contact 
AddressBook Modal Window slides into view 
Name of Contact is pressed 
If available, the contact's email address is stored in an array 
Dismiss modal window" 

내 현재 코드가 구성되어 여기

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier { 
    ABMultiValueRef container = ABRecordCopyValue(person, property); 
    CFStringRef contactData = ABMultiValueCopyValueAtIndex(container, identifier); 
    CFRelease(container); 
    NSString *contactString = [NSString stringWithString:(NSString *)contactData]; 
    CFRelease(contactData); 

    NSLog(@"Value is: %@", contactString); 

    [self dismissModalViewControllerAnimated:YES]; 
    return NO; 
} 

답변

5

내가하는 일입니다.

if(property == kABPersonEmailProperty) { 
    CFTypeRef prop = ABRecordCopyValue(person, property); 
    CFIndex index = ABMultiValueGetIndexForIdentifier(prop, identifierForValue); 
    NSString *email = (NSString *)ABMultiValueCopyValueAtIndex(prop, index); 

    ... 

    CFRelease(prop); 
    [email release]; 
} 
+0

이제 이것을 peoplePickerNavigationController : shouldContinueAfterSelectingPerson : property : identifier :'메소드에 넣으시겠습니까? 이 코드는 내가 제공 한 코드와 똑같은 일을하기 때문에 ... – rson

+0

죄송합니다. 메소드에 있어야합니다. 그렇다면 PeoplePicker를 모달로 여는 경우 위와 같이 해지해야합니다. –

관련 문제