morenoh149 / react-native-contacts

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

SIGABRT Error #562

Closed martellapetesso closed 4 years ago

martellapetesso commented 4 years ago

Hi everybody,

i have the following issue. I got everytime the signal SIGABRT Error in Xcode if i call the requestPermission() method. Thanks in advance.

Screenshot 2020-10-05 at 09 39 24
morenoh149 commented 4 years ago

what xcode, what react native version, etc.

martellapetesso commented 4 years ago

Oh sorry:

martellapetesso commented 4 years ago

Have any idea?

morenoh149 commented 4 years ago

no ideas yet.

please share code and outline your general approach, ie are you asking for permission first, are you configuring different permissions and then reading contacts?

martellapetesso commented 4 years ago

I configure on app start location permission. And on the contact screen i request the permission for contacts.

if(Platform.OS === 'ios') {

            Contacts.checkPermission((_, permission) => {

                if (permission === 'undefined') {
                    Contacts.requestPermission((err, permission2) => {
                        console.log("PERM: ", permission2)
                    })
                  }
            })

        } else {
            PermissionsAndroid.request(
                PermissionsAndroid.PERMISSIONS.READ_CONTACTS,
                {
                  'title': 'Contacts',
                  'message': 'This app would like to view your contacts.',
                  'buttonPositive': 'Please accept bare mortal'
                }
              ).then(() => {
                Contacts.getAll((err, contacts) => {
                  if (err === 'denied'){
                    console.log("DENIED")
                  } else {
                    console.log("CONTACTS: ", contacts)
                  }
                })
              })
        }