2

I'm having troubles in order to let my NativeScript app read contacts on iOS. I'm using the library nativescript-contacts in order to read all the entries of the address book and the one called nativescript-permission in order to ask the user the permission to read contacts. Unfortunately, the latter seems to work only in Android, where everything works fine: a pop-up appears asking the user to allow the reading of contacts and, if the permission is granted, the contacts are displayed in a list. In iOS instead, I'm not able to ask for contact permission: no dialog box pops out and when I try to use a function of nativescript-contacts (e.g. getAllContacts()), the app freezes.

I've tried searching, but the only thing I can do seems to use some native code in order to get these permissions... but I have no idea how. May you help me with this?

Thanks!

1 Answers1

3

There are two things you might need:

1st, did you add in the Info.plist file a message for the key Privacy: Contacts usage description ? This will display the message you set to the user when prompted the permission alert.

2nd. You can ask for the permission by calling requestAccess(for:completionHandler:). Check this

Robert D. Mogos
  • 900
  • 7
  • 14
  • I added the key in the Info.plist and everything works fine right now. Many thanks Robert, I was missing a really easy thing! – Luigi Russo Oct 23 '17 at 21:31