- #pragma mark - ios8之前调用的方法
- //ios8之前调用的方法
- - (BOOL) peoplePickerNavigationController: (ABPeoplePickerNavigationController * ) peoplePicker shouldContinueAfterSelectingPerson: (ABRecordRef) person NS_DEPRECATED_IOS(2_0, 8_0) {
- return YES;
- }
- //ios8之前调用的方法
- - (BOOL) peoplePickerNavigationController: (ABPeoplePickerNavigationController * ) peoplePicker shouldContinueAfterSelectingPerson: (ABRecordRef) person property: (ABPropertyID) property identifier: (ABMultiValueIdentifier) identifier NS_DEPRECATED_IOS(2_0, 8_0) {
- ABMultiValueRef phone = ABRecordCopyValue(person, kABPersonPhoneProperty);
- long index = ABMultiValueGetIndexForIdentifier(phone, identifier);
- NSString * phoneNO = (__bridge NSString * ) ABMultiValueCopyValueAtIndex(phone, index);
- phoneNO = [phoneNO stringByReplacingOccurrencesOfString: @"-"withString: @""];
- NSLog(@"%@", phoneNO);
- if (phone && phoneNO.length == 11) { [peoplePicker dismissViewControllerAnimated: YES completion: nil];
- return NO;
- } else {
- UIAlertView * alertView = [[UIAlertView alloc] initWithTitle: @"错误提示"message: @"请选择正确手机号"delegate: self cancelButtonTitle: @"确定"otherButtonTitles: nil]; [alertView show];
- }
- return YES;
- }
来源: http://lib.csdn.net/snippet/ios/42665