开发者

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?


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜