title: How to get a Phone Number from an Address Book Contact (iphone sdk)
body: <p>I am showing an addressbook view to the user and letting them click on a contact and select a phone number. If they select a phone number, I want to get the phone number as an integer and the contact's name as an NSString. </p>
  
  <p>I've tried doing it with the following code: </p>
  
  <pre><code>    //printf("%s\n",[[(NSArray *)ABMultiValueCopyArrayOfAllValues(theProperty) objectAtIndex:identifier] UTF8String]);
  
      //CFArrayRef *arrayString = [[(NSArray *)ABMultiValueCopyArrayOfAllValues(theProperty) objectAtIndex:identifier] UTF8String];
      NSArray *arrayString = [(NSArray *)ABMultiValueCopyArrayOfAllValues(theProperty) objectAtIndex:identifier];
      printf("%s\n", arrayString);
  </code></pre>
  
  <p>This code is inside this method:</p>
  
  <pre><code>- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
  </code></pre>
  
  <p>And I am checking if the user selected a phone number with this code:</p>
  
  <pre><code>if (propertyType == kABStringPropertyType)   
  {
      [self wrongSelection];
  
  } 
  else if (propertyType == kABIntegerPropertyType)     
  {
      [self wrongSelection];
  
  } 
  else if (propertyType == kABRealPropertyType)    
  {
      [self wrongSelection];
  } 
  else if (propertyType == kABMultiStringPropertyType)     
  {
       //This is the phone number...
  </code></pre>
  
  <p>I am able to get the phone number to display in the console with printf, however I can't figure out how to convert it into an integer and how to also get the contacts name even though the property selected is not a person's name. </p>
  
  <p>Also, what I'm doing seems very inefficient. Are there any better ways to do this?</p>
  
  <p>Edit: If I can't store them as an int, a string would be fine. I just can't figure out how to go from that array to an actual string. If I cast it or save it as a UTF8String I always get some error. </p>