title: How to determine the type of an address in AddressBook FrameWork (iOS 4.2)
body: <p>I´ve one big problem... I plan to write an app that deals with the users addressbook and it´s addresses. Everything´s fine - except the fact that I´m not able to determine whether the addesse´s type is "work", "home" or "other".</p>
  
  <p>Does anybody know how to get the label for home, work and other?</p>
  
  <p>Thanks in advance</p>
  
  <p>Boris</p>
  
  <p>This is the function I´m using at the moment:</p>
  
  <pre><code>    + (void)testing {
   //Get the addressbook
   ABAddressBookRef _addressBookRef = ABAddressBookCreate ();
  
   //Fetch all contacts
   NSArray* allPeople     = (NSArray *)ABAddressBookCopyArrayOfAllPeople(_addressBookRef);
  
   //Walk the contacts
   for (id record in allPeople) {
    //Get the contact´s id
    NSInteger recordId   = ABRecordGetRecordID((ABRecordRef)record);
  
    //Get the contact´s name and company
    NSString* recordName  = (NSString *)ABRecordCopyCompositeName((ABRecordRef)record);
    NSString* recordCompany  = (NSString *)ABRecordCopyValue((ABRecordRef)record, kABPersonOrganizationProperty);
  
    //Get the contact´s addresses
    CFTypeRef adressesReference = ABRecordCopyValue((ABRecordRef)record, kABPersonAddressProperty);
    NSArray *adressesArray  = (NSArray *)ABMultiValueCopyArrayOfAllValues(adressesReference);
    CFRelease(adressesReference);
  
    NSLog(@"ID:    %d", recordId);
    NSLog(@"Name:  %@", recordName);
    NSLog(@"Firma: %@", recordCompany);
  
    for (NSString *adress in adressesArray) {
     NSLog(@"Adresse: %@", adress);
    }
  
    [adressesArray release];
   }
  
   CFRelease(_addressBookRef);
   [allPeople release];
   NSLog(@"\n");
  }
  </code></pre>
  
  <p>And here´s the log output: </p>
  
  <p>ID:    1
  Name:  The first user
  Firma: (null)
  Adresse: {
      City = Reutlingen;
      Country = Germany;
      CountryCode = de;
      Street = "some street";
      ZIP = 23456;
  }</p>
  
  <p>Adresse: {
      City = Reutlingen;
      Country = Germany;
      CountryCode = de;
      State = BW;
      Street = "Street number 2";
      ZIP = 98765;
  }</p>
  
  <p>ID:    2
  Name:  The second contact
  Firma: Firma
  Adresse: {
      Country = "United States";
      CountryCode = us;
      Street = Test;
  }</p>