开发者

Jobtitle in addressbook

开发者 https://www.devze.com 2023-02-15 00:48 出处:网络
I am doing sample address book application, i am able to print firstname, lastname. But job title was not showing.

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);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消