Jobtitle in addressbook
I am doing sample address book application, i am able to print firstname, lastname. But job title was not showing. The sample code which i used is here,
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)thisPerson {
myText.text = [NSString stringWithString:@"Selected Contact:"];
myText.text = [myText.text stringByAppendingFormat:@"\n%@",
(NSString *)ABRecordCopyCompositeName(thisPerson)];
ABMutableMultiValueRef thisJob = ABRecordCopyValue(thisPerson, kABPersonJobTitleProperty);
if (thisJob != NULL) {
for (int k = 0; k < ABMultiValueGetCount(thisJob) ; k++) {
myText.text = [myText.text stringByAppendingFormat:@"\n%@: %@",
(NSString *)ABMultiValueCopyLabelAtIndex(thisJob, k),
(NS开发者_开发百科String *)ABMultiValueCopyValueAtIndex(thisJob, k)];
}
}
Can any one help me for this issue. Thank you.
ABRecordCopyValue(aPerson, kABPersonJobTitleProperty);
retuns CFStringRef not ABMutableMultiValueRef.
- (NSString *)jobTitleAtIndex:(NSUInteger)index {
return (NSString *)ABRecordCopyValue(aPerson, kABPersonJobTitleProperty);
}
精彩评论