GeeGoldz
GeeGoldz

Reputation: 187

ABPeoplePicker calls the number chosen

I'm using the people picker so the user can choose a phone number from their contacts to use in the app.

When the user clicks on the number, the phone app opens and that number is called...

Is there any way to stop this?

Upvotes: 0

Views: 561

Answers (2)

jaminguy
jaminguy

Reputation: 25930

Take a look at shouldPerformDefaultActionForPerson:

- (BOOL)personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)aPerson 
                    property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifierForValue {
            if(property == kABPersonPhoneProperty) {
              //save the number
              return NO;
            }
        return YES;
        }

--EDIT--

The above method is for ABPersonViewController which I mistook for ABPeoplePicker. The logic for ABPeoplePicker is the same as above only you would use this delegate call back instead:

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier

Upvotes: 2

GeeGoldz
GeeGoldz

Reputation: 187

I just forgot to return NO in the shouldContinueAfterSelectingPerson: method, I don't know where you got shouldPerformDecaultActionForPerson: from, it's not one of the delegation methods

Upvotes: 0

Related Questions