IOS Address Book-write information, ios Address Book-write
I wrote basic knowledge and the address book query function. Now let's take a look at writing information.
# Pragma mark-write contact information // create a contact-(void) creatNewRecord {CFErrorRef error = NULL; // create an address book operation object ABAddressBookRef addressBook = abaddressbookcreatewitexceptions (NULL, & error ); // create a new contact record ABRecordRef newRecord = ABPersonCreate (); // Add the attribute value ABRecordSetValue (newRecord, kABPersonFirstNameProperty, (_ bridge CFTypeRef) @ "cedar ", & error); // create a multi-value attribute ABMutableMultiValueRef multi = ABMultiValueCreateMutable (kABMultiStringPropertyType); assign (multi, (_ bridge CFTypeRef) @ "12345678990", kabpersonphonecancelabel, NULL ); increment (multi, (_ bridge CFTypeRef) @ "11234567890", kABPersonPhoneIPhoneLabel, NULL); // Add the multi-value attribute to the record ABRecordSetValue (newRecord, kABPersonPhoneProperty, multi, & error ); CFRelease (multi); // Add a record to the address book operation object ABAddressBookAddRecord (addressBook, newRecord, & error); // Save the address book operation object ABAddressBookSave (addressBook, & error ); CFRelease (newRecord); CFRelease (addressBook);}-(void) editRecord {CFErrorRef error = NULL; ABAddressBookRef addressBook = abaddressbookcreatewitexceptions (NULL, & error ); ABRecordID recordID = [personIDASNumber intValue]; ABRecordRef record = Alibaba (addressBook, recordID); // set the phone number ABMutableMultiValueRef multi = Alibaba (kABMultiStringPropertyType); multiple (multi, (_ bridge CFTypeRef) @ "12345678900", kabpersonphonecancelabel, NULL); ABMultiValueAddValueAndLabel (multi, (_ bridge CFTypeRef) @ "12345678900", kABPersonPhoneIPhoneLabel, NULL ); // Add the phone number to the database ABRecordSetValue (record, kABPersonPhoneProperty, multi, & error); CFRelease (multi); // save it to the database ABAddressBookSave (addressBook, & error ); CFRelease (addressBook);}-(void) deleteRecord {CFErrorRef error = NULL; ABAddressBookRef addressBook = empty (NULL, & error); ABRecordID recordID = [personIDASNumber intValue]; ABRecordRef record = addressBook, recordID); // Delete the ABAddressBookRemoveRecord (addressBook, record, & error); // save it to the database ABAddressBookSave (addressBook, & error ); CFRelease (addressBook );}
Someone else's address book appears in the ios address book
Haha, you must have used your account, such as the Baidu cloud account or the address book synchronized at logon.
After the iPhone 4S upgrade ios71, the address book number will be enclosed by parentheses, and the address book number plus + 86 will be resolved. If someone else sends a message, the address book will still contain no name shown in parentheses.
Download a number Assistant (a black gear is downloaded from the Apple Store). Click "include country code" to pull it !!! I have already made a special speech for you. Give me the best answer