Error Cannot read property 'toString' of undefined


#1

Hi All,

I just newbie in mobile develop and nativescript, I just follow https://docs.nativescript.org/tutorial/chapter-4 and get error when run the app with error message Cannot read property ‘toString’ of undefined in fetch.js –

please advise.

thanks you/.


#2

could you please post some code ??


#3

This is a common JavaScript error, from the error log I suspect you are missing method parameter in your call to fetch module.


#4

Hi All,
thanks for the replies,

the error is come from

viewModel.login = function() {
return fetchModule.fetch(config.apiUrl + “user/” + config.appKey + “/login”, {

I just need to add “appKey” property, and the app can run well, and its like manojdcoder said its common javascript error.

module.exports = {
apiUrl: “https://baas.kinvey.com/”,
appKey: “kid_HyHoT_REf”,
appUserHeader: “Basic a2lkX0h5SG9UX1JFZjo1MTkxMDJlZWFhMzQ0MzMyODFjN2MyODM3MGQ5OTIzMQ”
};

many thanks.