0

My iPad app collects some user data, including name, address, phone, etc. I have a button that allows the user to create a new contact from this collected data.

Right now, my code creates a contact record (ABRecordRef) and sets some values (ABRecordSetValue). All the sample code I've found for the next step creates an ABUnknownPersonViewController and presents it in the existing navigationController.

I can get this all to work, but I don't want to use the navigationController, however when I present this in a modal view I don't know how to detect when the user has finished adding the contact once the Contacts page is shown. As well, I don't know why there are so many screens involved--I would like them to just hit my button and voila; the data is added as a Contact.

So, some questions:

  1. Do I need to present an ABUnknownPersonViewController or can I bypass all of that and just write the data out to the Address Book?

  2. If not, can I at least bypass one of the two screens presented (after the ABUnknownPersonViewController screen, a Contacts screen with edit ability is presented)?

  3. If I present the ABUnknownPersonViewController in a modal view can I detect when the Contacts page is finished so I can remove the view?

Thanks!

Kent
  • 1,705
  • 3
  • 16
  • 26
  • 1
    I would use the ABNewPersonViewController if anything, not UnknownPerson – erdekhayser Mar 19 '14 at 00:32
  • OK. But, do you have to use one of "their" views before jumping to the Contacts app-type page? – Kent Mar 19 '14 at 01:23
  • There is no requirement to use that. Using the AddressBook API by itself is pretty common. I have 3 apps using the AddressBook without any of "their" views. Here's the link to one of them if you want to see what I mean (I created the table from scratch, not using "their" views) https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCoQFjAA&url=https%3A%2F%2Fitunes.apple.com%2Fus%2Fapp%2Fcontact-archiver%2Fid733594022%3Fmt%3D8&ei=z_8oU6iAHcbD0AHbk4DgBw&usg=AFQjCNF2-z-OdMsfS60TUGQJFvepdak7uQ&sig2=uffSIeFddbVMLmpNOlbLeA&bvm=bv.62922401,d.dmQ – erdekhayser Mar 19 '14 at 02:24
  • @erdekhayser That's good news and I see what you mean. But how do I bypass ABxxxPersonViewController? All the code I find online uses it to pass the data to the Address Book. I need to do it programmatically and can't figure out how! – Kent Mar 19 '14 at 02:31
  • One will be coming out mid-April, but I am assuming that now would be more helpful. Look at apple's demo code: https://developer.apple.com/library/ios/documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Chapters/QuickStart.html – erdekhayser Mar 19 '14 at 02:33

1 Answers1

0

erdekhayser's comments put me on to the Apple docs which led me to this post here: How to add new contact to iOS Address Book?

This appears to be a good example of how to do this programatically.

Community
  • 1
  • 1
Kent
  • 1,705
  • 3
  • 16
  • 26