title: How to prevent crash when selecting specific contact using AdressBookUI
body: <p>I'm getting crash on this line.</p>
  
  <pre><code>    phoneNumber = CFBridgingRelease(ABMultiValueCopyValueAtIndex(numbers, index));
  </code></pre>
  
  <p>If the first phone number is selected I get index of 1 which is wrong. It should be 0 and therefore choses wrong number. If I select second number it gives index of -1 which crashes the app.</p>
  
  <pre><code>#pragma mark helper methods
  
  - (void)didSelectPerson:(ABRecordRef)person identifier:(ABMultiValueIdentifier)identifier {
      NSString *phoneNumber = @"";
      ABMultiValueRef numbers = ABRecordCopyValue(person, kABPersonPhoneProperty);
      if (numbers) {
          if (ABMultiValueGetCount(numbers) &gt; 0) {
              CFIndex index = 0;
              if (identifier != kABMultiValueInvalidIdentifier) {
                  index = ABMultiValueGetIndexForIdentifier(numbers, identifier);
              }
              phoneNumber = CFBridgingRelease(ABMultiValueCopyValueAtIndex(numbers, index));
          }
          CFRelease(numbers);
      }
      self.numberTextField.text = [NSString stringWithFormat:@"%@", phoneNumber];
  }
  </code></pre>