morenoh149 / react-native-contacts

React Native Contacts
MIT License
1.65k stars 564 forks source link

App is crashing on getCount and getAll #655

Closed asalha closed 2 years ago

asalha commented 2 years ago

Hello,

I followed exactly the same requirements as mentioned in the README file. When I check the permission status it's "granted" then I run Contacts.getCount() or Contacts.getAll() the app crashes on Android (simulator and real device).

Any idea?

kruz123 commented 2 years ago

Hello,

@asalha please share your code because recently i used this library and its working fine. so please share your code with for better understanding what you faced your problem and trying to solve your problem.

Thanks.

ZaharGusyatin commented 2 years ago

any updates?

sheggietyn commented 2 years ago

same here the App keep crashing/ closing when i try to display all contact

kruz123 commented 2 years ago

Hello,

@sheggietyn please share your code . Thanks.

hocraveiro commented 2 years ago

I had the same problem recently, it was because I didn't declare the contact permission at AndroidManifest.xml

<uses-permission android:name="android.permission.READ_CONTACTS" />

Just add this line in your AndroidManifest.xml and run npx react-native run-android again

kruz123 commented 2 years ago

hello @hocraveiro his issue is that when he shows all his contacts, then his app crashes. not like your issue

biplovappservinc commented 2 years ago

@hocraveiro same here

biplovappservinc commented 2 years ago

@asalha

just add permission in Info.plist

    <key>NSContactsUsageDescription</key>
    <string>Contact Permission</string>

then it will be solved

mortocks commented 2 years ago

Features work for me, suspect you've forgotten to add permissions to android or iOS info.plist as @biplovappservinc suggests

rajAmukhliS commented 2 years ago

This is because in android you didn't allow permission of READ_CONTACTS.

To get rid of this crash you have to write READ_CONTACTS permission inside AndroidManifest.xml

Write the below permission inside android/app/src/AndroidManifest.xml

...
<uses-permission android:name="android.permission.READ_CONTACTS" />
...