2011-05-30 75 views
0

我使用的是人员选择器,因此用户可以从联系人中选择一个电话号码以在应用中使用。ABPeoplePicker拨打所选号码

当数用户点击,手机应用程序打开,这个数字叫...

有没有什么办法阻止呢?

回答

2

看一看shouldPerformDefaultActionForPerson:

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

- 编辑 -

上述方法是用于ABPersonViewController我误认为ABPeoplePicker。对于ABPeoplePicker的逻辑是一样的上面只有你会使用这个委托回调来代替:

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

我只是忘了在shouldContinueAfterSelectingPerson返回NO:方法,我不知道你在哪里得到shouldPerformDecaultActionForPerson:从,这不是授权方法之一