My App is crashing while using any method of react-native-contacts.
function getPhoneRecords() {
PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.WRITE_CONTACTS,
PermissionsAndroid.PERMISSIONS.READ_CONTACTS,
]).then(() => {
Contacts.getAll((err, contacts) => {
if (err) {
console.log(err, 'failed to fetch phone Records!');
} else {
setPhoneRecords(contacts);
}
});
});}
Here is the function to getAllContacts but whenever this function executes my app crashes with no error. How can I solve this issue? Thanks in Advance.
If it crash on iOS :
Check if you have updated your Info.plist file. You must have the key «Privacy - Contacts Usage Description» with a sentence in value.
Follow the documentation : https://github.com/morenoh149/react-native-contacts#ios-2
If it crash on Android :
Check if you have updated your AndroidManifest.xml file. You must request permission, like iOS.
Follow the documentation : https://github.com/morenoh149/react-native-contacts#permissions