I followed the steps in the README to implement react-native-contacts, but every time I use Contacts it crashed my app. My
useEffect(() => {
console.log('Running useEffect');
// This prints: `Permissions – null – "undefined"`
Contacts.checkPermission((err, result) => console.log('Permissions', err, result));
// This crashes app
Contacts.getAll((err, contacts) => console.log('Contacts', err, contacts));
}, []);
React Native: 0.61.4
React Native Contacts: 5.0.4
Fixed by adding below to Info.plist - according to the instructions this only needs to be done for "react native below 60". Is this an error in the README?
<key>NSContactsUsageDescription</key>
<string>Reason for accessing contacts</string>
@prathd I was facing the same issue yesterday. But I fixed it by adding
<key>NSContactsUsageDescription</key>
<string>Reason for accessing contacts</string>.
I think it's a mistake in the README file. It would be better if it's updated.
Thank you. 👍
Just a note, I just had to do what prathd and AmalaLiza suggested with the latest release (5.2.0) on the latest react native (0.62.2) after having the same issue.
@mpraksti-alchemy we instruct the user on how to add NSContactsUsageDescription to Info.plist through xcode's UI at https://github.com/morenoh149/react-native-contacts#ios-2 did that not work for you? Does the readme need improvement?
None from above worked for me, any suggestions please?
Most helpful comment
Fixed by adding below to Info.plist - according to the instructions this only needs to be done for "react native below 60". Is this an error in the README?