question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: Cannot read property 'done' of undefined

See original GitHub issue

I’m using the plugin on Android and iOs, first i, use the plugin the simpliest way, like this inside a deviceready event :

AppRate.preferences.storeAppURL = {
          ios: 'MYAPPNUMBER',
          android: 'market://details?id=com.app'
      };

      AppRate.promptForRating(false);

it works fine but when i’m trying tu put custom messages, i’m getting this error in console :

AppRate.js:98 Uncaught TypeError: Cannot read property 'done' of undefined
    at showDialog (AppRate.js:98)
    at Function.AppRate.promptForRating (AppRate.js:203)
    at Channel.<anonymous> (app.js:136)
    at Channel.fire (cordova.js:822)
    at cordova.js:231

this is my final code :

var msg = 'lorem ipsum ....';

AppRate.preferences = {
        openStoreInApp: false,
        displayAppName: '',
        usesUntilPrompt: 3,
        promptAgainForEachNewVersion: false,
        storeAppURL: {
          ios: 'MYAPPNUMBER',
          android: 'market://details?id=com.my.app'
        },
        customLocale: {
          title: 'Vous aimez l\'application ?',
          message: msg,
          cancelButtonLabel: "Non merci",
          laterButtonLabel: "Plus tard",
          rateButtonLabel: "Oui, je donne mon avis"
        }
      };


      AppRate.promptForRating(false);

it works fine when i use promptFotRating without false…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
NBAMjcommented, Jul 30, 2017

Yeah same issue with 1.3.0

3reactions
oangelocommented, Mar 10, 2017

@wroquet, I managed to make it work. You must define the callbacks, other wise you will get that error. I have defined them as empty functions and everything is now working as expected. But this is not clear at all at the README. Here is my code in coffeescript:

    #ask for user review
    if AppRate
      AppRate.preferences =
        openStoreInApp: true,
        displayAppName: 'Física Básica',
        usesUntilPrompt: 2,
        promptAgainForEachNewVersion: false,
        storeAppURL:
          ios: '<my_app_id>',
          android: 'market://details?id=com.resumosmoveis.mecanica'
        customLocale:
          title: "Avalie o nosso APP!",
          message: "Nossa equipe está sempre trabalhando para deixar este APP cada vez melhor. Você poderia avaliar nosso APP e deixar uma msg de incentivo para equipe? Sua opinião e incentivo são muito importantes!",
          cancelButtonLabel: "Não, obrigado.",
          laterButtonLabel: "Lembre-me mais tarde.",
          rateButtonLabel: "Avaliar agora!"
        callbacks:
          onButtonClicked: (buttonIndex) ->
              console.log("onButtonClicked -> " + buttonIndex)
          onRateDialogShow: (callback) ->
            return
      AppRate.promptForRating(false)
      console.log("APP Rate")

Cleaning the cache and opening the app twice will ask for the user review.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
Uncaught TypeError: Cannot read property of undefined In
JavaScript TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or...
Read more >
jquery Cannot read property 'done' of undefined - avoid this
You could just return a deferred, that way the done() callback won't generate errors, and you can choose to resolve it or not...
Read more >
Uncaught TypeError : Cannot read properties of undefined
Looking for ways to handle Uncaught TypeError: Cannot read property of undefined in JavaScript? This guide will help you to catch errors.
Read more >
Resolving the JavaScript Promise Error "TypeError: Cannot ...
TypeError - Cannot read property 'then' of undefined is thrown when the caller is expecting a Promise to be returned and instead receives ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found