XCode'u (6.0, 6A313) ve iOS'umu (8.0, 12A365) iPhone'da gm tohumlarına güncellediğimden beri, ABPeoplePickerNavigationController kodu daha önce olduğu gibi çalışmıyor.ABPeoplePickerNavigationController iOS8 ile değiştiriyor?
iOS 7.1.2: Birisi bir kişiyi almak istiyorsanız, adres defteri açılır ve bir toplama sonra, kişiler tam listesini görmek, bir kişinin ayrıntı görünümü açılır ve ekleyebilir daha Almak istediğiniz telefon numarasına bir tıklama ile iletişim kurun.
iOS 8.0: onun her şeyi benzer ancak bunu yerine aktarmadan telefon numarasını aramak bir kişinin numarasını tıklayın eğer ..
Kodu:
#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];
}
yapamadım Apple iOS geliştirici kitaplığında herhangi bir cevap bulmak. , bunun için başka bir çözüm var mı?
Bu, iOS 8.0.1'de benim için çalışmıyor. Uygulamam gereken başka delege yöntemleri var mı? Temsilcim iptal yönteminin dışında hiç vurulmuyor. – Alexander
@AlexanderCollins Bu, 8.0.1 ile benim için gayet iyi çalışıyor. Temsilcinizin ayarlandığından emin misiniz? – rmaddy
Evet, iptal temsilci yöntemim doğru şekilde vuruluyor. Bir kişinin telefon numarasını seçmek, sadece didSelect: delege yöntemimi kullanmak yerine bu kişiyi arar. – Alexander