gm 씨앗에 iPhone에서 XCode (6.0, 6A313) 및 iOS (8.0, 12A365)를 업데이트 했으므로 ABPeoplePickerNavigationController 코드가 이전과 같이 작동하지 않습니다.ABPeoplePickerNavigationController가 iOS8로 변경 되었습니까?
아이폰 OS 7.1.2 : 누군가가 연락처를 가져 오려면, 주소록이 열리고 하나를 따기 후, 연락처의 전체 목록을 보려면, 그것은 연락처의 상세보기를 열고 당신은 추가 할 수있는 것보다 가져 오려는 전화 번호를 클릭하십시오.
아이폰 OS 8.0의 모든 유사하지만 당신이 대신 가져 오기의 전화 번호로 전화를 걸 접촉의 번호를 클릭하면 ..
코드 :
#pragma mark - AddressBook Delegate Methods
-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person{
return YES;
}
-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{
// Get the first and the last name. Actually, copy their values using the person object and the appropriate
// properties into two string variables equivalently.
// Watch out the ABRecordCopyValue method below. Also, notice that we cast to NSString *.
NSString *firstName = (__bridge NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
NSString *lastName = (__bridge NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
// Compose the full name.
NSString *fullName = @"";
// Before adding the first and the last name in the fullName string make sure that these values are filled in.
if (firstName != nil) {
fullName = [fullName stringByAppendingString:firstName];
}
if (lastName != nil) {
fullName = [fullName stringByAppendingString:@" "];
fullName = [fullName stringByAppendingString:lastName];
}
// Get the multivalue number property.
CFTypeRef multivalue = ABRecordCopyValue(person, property);
// Get the index of the selected number. Remember that the number multi-value property is being returned as an array.
CFIndex index = ABMultiValueGetIndexForIdentifier(multivalue, identifier);
// Copy the number value into a string.
NSString *number = (__bridge NSString *)ABMultiValueCopyValueAtIndex(multivalue, index);
nameTextField.text = fullName;
numberTextField.text = number;
// Dismiss the contacts view controller.
[_addressBookController dismissViewControllerAnimated:YES completion:nil];
return NO;
}
// Implement this delegate method to make the Cancel button of the Address Book working.
-(void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker{
[_addressBookController dismissViewControllerAnimated:YES completion:nil];
}
는 할 수 없었다 사과의 iOS 개발자 라이브러리에서 답변을 찾으십시오. 누군가 다른 사람에게 해결책이 있습니까?
iOS 8.0.1에서는 작동하지 않습니다. 구현해야하는 다른 대리자 메서드가 있습니까? cancel 메서드를 제외하고는 내 대리자가 전혀 공격을받지 않습니다. – Alexander
@AlexanderCollins 8.0.1에서는 잘 작동합니다. 당신의 대의원이 설정되어 있습니까? – rmaddy
그래, 내 취소 대리인 메서드가 제대로 때리고있다. 연락처의 전화 번호를 선택하면 내 didSelect : delegate 메소드를 누르는 대신 해당 연락처가 호출됩니다. – Alexander