私のviewdidloadで次のコードを使用しようとしましたが、テストiPhone(IOS 6を実行)にテスト連絡先をロードできないようです。これが機能しない理由について何か提案はありますか?
CFErrorRef* error;
// create address book record
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(nil,error);
// create a person
ABRecordRef person = ABPersonCreate();
// first name of the new person
ABRecordSetValue(person, kABPersonFirstNameProperty, @"FirstName" , nil);
// his last name
ABRecordSetValue(person, kABPersonLastNameProperty, @"LastName", nil);
//add the new person to the record
ABAddressBookAddRecord(addressBook, person, nil);
ABRecordRef group = ABGroupCreate(); //create a group
ABRecordSetValue(group, kABGroupNameProperty,@"My Group", error); // set group's name
ABGroupAddMember(group, person, error); // add the person to the group
ABAddressBookAddRecord(addressBook, group, error); // add the group
//save the record
ABAddressBookSave(addressBook, nil);
// relase the ABRecordRef variable
CFRelease(person);