Ionic version:
[x] 3.x
I'm submitting a ...
[x] bug report
Current behavior:
I'm getting the error message below
1) In Chrome (Windows) - I get the error
2) In Safari (El Capitan) - I get the error
3) On the iOS device itself - I don't get the error and I'm able to rate the app as expected
Am I missing something or is this a bug?
ERROR Error: Uncaught (in promise): TypeError: Cannot set property 'storeAppURL' of null
TypeError: Cannot set property 'storeAppURL' of null
at settings.ts:76
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.es5.js:4149)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.es5.js:4140)
at t.invokeTask (polyfills.js:3)
at r.runTask (polyfills.js:3)
at settings.ts:76
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.es5.js:4149)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.es5.js:4140)
at t.invokeTask (polyfills.js:3)
at r.runTask (polyfills.js:3)
at c (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.es5.js:4140)
at t.invokeTask (polyfills.js:3)
at r.runTask (polyfills.js:3)
at o (polyfills.js:3)
at HTMLAnchorElement.invoke (polyfills.js:3)
Expected behavior:
I expect no errors
Related code:
Please take a look at the code in my repo
https://github.com/gigocabrera/CajaFuerte-app/blob/master/src/pages/settings/settings.ts#L76
Other information:
Ionic info:
PS C:\ionic\CajaFuerte-app> ionic info
global packages:
@ionic/cli-utils : 1.4.0
Cordova CLI : 7.0.1
Ionic CLI : 3.4.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms : ios 4.3.1
Ionic Framework : ionic-angular 3.4.2
System:
Node : v7.9.0
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.8
I found a workaround for this issue. It's working fine but I'm sure this is a bug.
if (platform.is('cordova')) {
this.appRate.preferences.storeAppURL = {
ios: '1206710447'
}
}
It would work fine if you define the whole this.appRate.preferences object. See the second example in here http://ionicframework.com/docs/native/app-rate/
I will take out the first one. I thought I already removed it earlier.
Hi @ihadeed, when you say "See the second example in here..." do you mean this one?
// or, override the whole preferences object
this.appRate.preferences = {
usesUntilPrompt: 3,
storeAppURL: {
ios: '<app_id>',
android: 'market://details?id=<package_name>',
windows: 'ms-windows-store://review/?ProductId=<store_id>'
}
};
Yes
I'm getting an error @ihadeed when I try that approach:
Uncaught (in promise): TypeError: Cannot read property 'split' of undefined
TypeError: Cannot read property 'split' of undefined
at Function.Locales.getLocale (http://192.168.1.2:8100/plugins/cordova-plugin-apprate/www/locales.js:53:74)
at showDialog (http://192.168.1.2:8100/plugins/cordova-plugin-apprate/www/AppRate.js:91:29)
at Function.AppRate.promptForRating (http://192.168.1.2:8100/plugins/cordova-plugin-apprate/www/AppRate.js:203:7)
at callCordovaPlugin (http://192.168.1.2:8100/build/vendor.js:77234:43)
at http://192.168.1.2:8100/build/vendor.js:77260:28
at http://192.168.1.2:8100/build/vendor.js:58635:17
at new t (http://192.168.1.2:8100/build/polyfills.js:3:20886)
at tryNativePromise (http://192.168.1.2:8100/build/vendor.js:58634:20)
at getPromise (http://192.168.1.2:8100/build/vendor.js:58642:12)
at wrapPromise (http://192.168.1.2:8100/build/vendor.js:77243:78)
@ihadeed Still I can see the wrong first example on the doc. Hope you'll remove it. Thanks.
@gigocabrera Hello, I don't know if it's too late, but I recently encountered this error and was able to solve it by running the app on a real device. Ionic documentation says that some ionic cordova native plugins are able to run properly only on real devices. This is one of them. Try running it on a real device. And, both the examples of the doc work for me.
Most helpful comment
It would work fine if you define the whole this.appRate.preferences object. See the second example in here http://ionicframework.com/docs/native/app-rate/
I will take out the first one. I thought I already removed it earlier.