Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR TypeError: Cannot read property 'getPreferences' of undefined #304

Closed
lucasramosdev opened this issue Mar 2, 2021 · 1 comment
Closed

Comments

@lucasramosdev
Copy link

i confirm the plugin works fine and its @ionic-native/app-rate issue
use the AppRate object from window and it should work as expected

    // tslint:disable-next-line: no-string-literal
    const appRate: any = window['AppRate'];
    const preferences = appRate.getPreferences();
    preferences.simpleMode = true;
    preferences.storeAppURL = {
      ios: 'id123456789',
      android: 'market://details?id=com.example.app',
      windows: 'ms-windows-store://review/?ProductId=XXXXXXXX',
    };
    appRate.setPreferences(preferences);
    appRate.promptForRating(true);

possible reference #291

Originally posted by @wnabil in #295 (comment)

I tried this way and response:
ERROR TypeError: Cannot read property 'getPreferences' of undefined
at AppComponent.rateMe (app.component.ts:47)
at AppComponent_Template_ion_item_click_15_listener (template.html:31)
at executeListenerWithErrorHandling (core.js:14316)
at wrapListenerIn_markDirtyAndPreventDefault (core.js:14351)
at HTMLElement. (platform-browser.js:582)
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
at Object.onInvokeTask (core.js:27425)
at ZoneDelegate.invokeTask (zone-evergreen.js:398)
at Zone.runTask (zone-evergreen.js:167)
at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:480)

Config:
"@ionic/angular": "5.5.2",
"@ionic-native/app-rate": "5.31.1",
"cordova-plugin-apprate": "^1.7.2",

@lucasramosdev lucasramosdev changed the title RROR TypeError: Cannot read property 'getPreferences' of undefined ERROR TypeError: Cannot read property 'getPreferences' of undefined Mar 2, 2021
@lucasramosdev
Copy link
Author

I got it the solve:

Was just build the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant