How can I add custom fields to contacts info in iphone contact list
-
I am developing a app in which I have to add custom contacts to iPhone Contact list. To elaborate that every contact in iPhone have a definite set of fields which we can be used to save contact info. I want to know if we can add custom fields apart from that ofexisting options in iPhone. If its possible please show me the way to do that, googled it but didn't found any thing meaningfull. Thanks in advance.
-
Answer:
From http://www.iphonedevsdk.com/forum/iphone-sdk-development/12496-add-contact-address-book.html ABRecordRef aRecord = ABPersonCreate(); CFErrorRef anError = NULL; ABRecordSetValue(aRecord, kABPersonFirstNameProperty, CFSTR("Jijo"), &anError); ABRecordSetValue(aRecord, kABPersonLastNameProperty, CFSTR("Pulikkottil"), &anError); if (anError != NULL) { NSLog(@"error while creating.."); } CFStringRef firstName, lastName; firstName = ABRecordCopyValue(aRecord, kABPersonFirstNameProperty); lastName = ABRecordCopyValue(aRecord, kABPersonLastNameProperty); ABAddressBookRef addressBook; CFErrorRef error = NULL; addressBook = ABAddressBookCreate(); BOOL isAdded = ABAddressBookAddRecord ( addressBook, aRecord, &error ); if(isAdded){ NSLog(@"added.."); } if (error != NULL) { NSLog(@"ABAddressBookAddRecord %@", error); } error = NULL; BOOL isSaved = ABAddressBookSave ( addressBook, &error ); if(isSaved){ NSLog(@"saved.."); } if (error != NULL) { NSLog(@"ABAddressBookSave %@", error); } CFRelease(aRecord); CFRelease(firstName); CFRelease(lastName); CFRelease(addressBook); If you need to store data in there, I think your only option is kABPersonNoteProperty, but I'm no expert on this. Edit: http://stackoverflow.com/questions/1418319/does-iphone-support-adding-custom-properties-to-address-book-records Answer: nope! Edit: you can also prompt the user to add an address book entry as done here http://stackoverflow.com/questions/1041410/how-to-get-around-lack-of-add-button-in-abpeoplepickernavigationcontroller
Ankit Sachan at Stack Overflow Visit the source
Other answers
It is not possible to programmatically add custom fields to the iPhone address book, even in iOS 5.
Duncan Babbage
Related Q & A:
- How do I add custom attributes to javascript tags in Wordpress?Best solution by WordPress
- How can I get custom fields in wordpress?Best solution by Stack Overflow
- How do I forward an e-mail to someone using my contact list?Best solution by Yahoo! Answers
- Help! How do I add some of my contacts to Yahoo Messenger?Best solution by Yahoo! Answers
- How Can I add yahoo Messenger contacts into my Yahoo mail contacts?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.