最近測試發現了個問題,以前調用通訊錄的代碼工程用Xcode6打包後,在ios8系統上通訊錄調用不了,點擊沒有任何反應;
真機測試時,發現調用通訊錄的代理方法不調用了,鏈接進去看,就明白了:
// Deprecated, use predicateForSelectionOfPerson and/or -peoplePickerNavigationController:didSelectPerson: instead.
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person NS_DEPRECATED_IOS(2_0, 8_0);
// Deprecated, use predicateForSelectionOfProperty and/or -peoplePickerNavigationController:didSelectPerson:property:identifier: instead.
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier NS_DEPRECATED_IOS(2_0, 8_0);
這兩個代理方法廢棄了,用新的方法代替,新的代理方法裏也不需要dismiss消失了;新的代理:
-(void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person
-(void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
爲了能兼容之前的系統,原來的代理方法保留,新增這兩個代理方法,但是發現有個問題,當我添加這兩個方法後,運行點擊調用通訊錄後,選中人名後直接就返回了,原本人名後的號碼詳細頁面沒有彈出來;後來發現只需要添加didSelectPerson: property: 這個代理方法就可以了,第一個didSelectPerson方法不需要添加;通訊錄問題就此解決了。。。