Search code examples
ioscontactsdirectoryimport-contacts

Adding folders within iOS app


I am pretty new to the world of iOS development and I would appreciate your help.

Currently in my project, I want the user to:

  • create a new folder
  • name the folder
  • add contacts from the user's contacts
  • save them to this folder

How can I create folders within the app and have these folders hold contact information? In addition, the reason I want to be able to do this is to have the user sort their contacts into folders. If there is a better approach I welcome all suggestions.


Solution

  • When I first read your post's subject I thought you meant file system folders (Directories). You can use NSFileManager calls to do that, within the limits of the iOS sandbox.

    However, it sounds like you are taking about application-level logical folders.

    You need to read up on the address book APIs. I haven't used them before, so I don't have any specific help for you. I do know that the address book is Core Foundation, which is C level APIs, and harder to use then NSObject-based classes.

    Do you have experience in C or another programming language? If you are both new to iOS and to programming, then you are in way, way over your head and need to tackle some simpler projects first.

    You will need to come up with a design that lets you represent logical folders-full of contacts. You could probably use nested NSArrays, or better yet, use Core Data to save your contact information.

    Explaining how to do either of those things is beyond the scope of a forum post.