Skip to content

TypeError: Cannot read property 'checkSelfPermission' of undefined #4

@sido420

Description

@sido420

I did not find sample usage details in demo app.

There is no existing issue related to this.

  • Android (not tested on iOS)

  • Android 8.1.0

  • ASUS Zenphone

  • CLI: 6.7.8

  • Cross-platform modules: "6.5.0"

  • Runtime(s): 6.5.0 (both)

  • Plugin(s): let me know if needed

Here is code example:

import { getTypes, request, RequestOptions, Rationale, check, Permissions } from '@nativescript-community/perms';
declare var global: any;


export const getPermissionTypes = () => {
    console.log(`Getting  permission types for the platform`)
    console.log(getTypes());
}

export const requestContactsPermission = (): Promise<any> => {
    let perm: Permissions = `contacts`;
    let rationale: Rationale = {
        title: global.AppName + ' contacts permission',
        message: global.AppName + ' needs access to your contacts.',
        buttonPositive: "OK", // optional
        //buttonNegative?: string;
        //buttonNeutral?: string;
    },
        opts: RequestOptions = {
            type: 'always',
            rationale
        };
    return request(perm, opts).then(response => {
        //this.setState({ locationPermission: response[0] })
        console.log(response)
    });
}

getPermissionTypes works fine but requestContactsPermission throws the error in title in the calling function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions