Skip to content

Unable to getAllContacts on iOS 13 #79

@fpaaske

Description

@fpaaske

It seems that something is broken when using this library on iOS 13. The permission request pops up, and there are no error messages. But the response is always an empty list.

Same code on iOS 12 or below works fine.

To reproduce

tns create contacts-test --template tns-template-hello-world-ng
cd contacts-test
tns info
✔ Getting NativeScript components versions information...
✔ Component nativescript has 6.2.0 version and is up to date.
✔ Component tns-core-modules has 6.2.0 version and is up to date.
✔ Component tns-android has 6.2.0 version and is up to date.
✔ Component tns-ios has 6.2.0 version and is up to date.
yarn add nativescript-contacts

add to Info.plist:

<key>NSContactsUsageDescription</key>
<string>Kindly provide permission to access contact on your device.</string>

add to items.component.ts

import { getAllContacts } from "nativescript-contacts";
<snip>
    ngOnInit(): void {
        this.items = this.itemService.getItems();
        getAllContacts().then(contacts => console.log(`got ${contacts.data.length} contacts`));
    }

Open multiple emulators from iOS 10 to iOS 13.

tns run ios --emulator

See that contacts.data.length is 0 for iOS 13.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions