abhayastudios / nativescript-contacts-lite

This nativescript-contacts-lite plugin provides pretty fast read-only access to the iOS and Android contact directory.
MIT License
13 stars 7 forks source link

Not able to Access Contacts in IOS(though works, when page loads), if permission is disabled and then enabled from Phone Settings #9

Closed vasudevpareek07 closed 4 years ago

vasudevpareek07 commented 4 years ago

Hi Jonothan Solomon,

I am using this plugin, In Android, it works fine, whereas in IOS also for the first time I am getting all the contacts.

But the catch is, in IOS if I go to phone settings and disable the permission for contacts and come back to app, since I do not have the permission, ideally it should go to the error block of promise, but it doesn't go.

Sample Code (Which does not work in IOS)

Contacts.getContacts(this.desiredFields).then( (result: Array<ContactLiteObject>) => { this.result = result; } }, e => { this.emitRes(); console.dir(e); } );

But, If I want to filter contacts based on search term in the code, and now in the app settings if I disable the contacts permission, then, it goes inside the error block of the promise, which takes care of showing the error.

Sample Code (Which works in IOS)

Contacts.getContacts(this.desiredFields, 'Kate', true).then( (result: Array<ContactLiteObject>) => { this.result = result; } }, e => { this.emitRes(); console.dir(e); } );

Desired Result:

Irrespective of search term, I should get the contacts If permission is enabled and if permission is disabled, it should go inside error block of promise (So, that i can show to the user that "You do not have access"). Any quick help is much appreciated. Thanks.

abhayastudios commented 4 years ago

@vasudevpareek07 pls check out release v0.2.7. If it contains what you are looking for then please close this issue.

abhayastudios commented 4 years ago

Closing, pls re-open if there is a problem with it still.