iosswiftcontacts-framework

Using the Swift Contacts Framework


When the app has access to the devices contacts, and you need those contacts to populate a PickerView, does it pull the contacts to a Firebase DB and fetch those contacts to populate the PickerView? Or does it do it within the phone(maybe Core Data)?

Any advice or guidance would be greatly appreciated.

If does and I can use Core Data, can I use it hand in hand with Firebase, or does it even store it somewhere? I'd like my users to be able to select which contacts they want to add to the app.

Thank you in advance.


Solution

  • I think it would be best to pull from the device's Contacts, using the Contacts Framework - in Xcode this is the Contacts.framework package. The Apple site offers some sample code that you might be able to take advantage of in your application. For that you'd need permission from the user by enabling a NSContactsUsageDescription in your info.plist. That describes to the user why you'd need access to their contacts.

    As far as storing the data in a Database, I'm not sure that would be a wise decision nor one that makes sense. Consider the reasoning behind that, does this information need to be on some remote database? if your answer is no, then chances are that you don't need to do that extra work. You might however register new users that use your application with something like Google's Firebase if you want to manage any messages between users (for a chat app for example).

    Hopefully that answers your question and helps you out in some way.