0

I am currently implementing address book in my application. But I am getting one issue with address book that is I want to pass contacts from address book according to their contact type. I mean to say that is if contact type is personal then save in personal category or if that is business type then save in business category.

But in address book I don't get any event which can categories contacts according to their type. If anyone have any idea then share with me.

I have use this code also but I always get personal type contact.

    CFNumberRef recordType = ABRecordCopyValue(aSource, kABPersonKindProperty);
    if (recordType == kABPersonKindPerson) {
        phone_book_data.Type=[NSString stringWithFormat:@"personal"];
    } 
    else{
        phone_book_data.Type=[NSString stringWithFormat:@"business"];
    }     
Sathyajith Bhat
  • 21,321
  • 22
  • 95
  • 134
ios
  • 552
  • 5
  • 22

2 Answers2

0

There are two types of contacts can be inserted in iphone addressbook. (1)Person and (2)Organization. I don't know how to add Organization contact in iPhone address book but i know that if it will detect record type "kABPersonKindOrganization" in your code it will go in to else loop. So, if you can find how to insert oraganization contact in to your phone book you can test it perfectly.

Try Calnedar
  • 31
  • 1
  • 1
  • 5
0

From ABPerson Reference:

Person Type Property

These constants implement the person type property (a property of type kABIntegerPropertyType), which indicates whether a person record represents a human being or an organization.

const ABPropertyID kABPersonKindProperty;
const CFNumberRef kABPersonKindPerson;
const CFNumberRef kABPersonKindOrganization;
Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107
Cliff Harris
  • 754
  • 2
  • 7
  • 9