Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Simulator failing on today

ANSWERED

There's no way in the simulator to mock "today.local.xxxx". That's ok I can do it in my project. But when I try -

console.log((today.local.steps || 0) + " steps");

I get -

Unhandled TypeError: Cannot read property 'steps' of undefined

I have -

import { today } from "user-activity";

 

Is this a problem with the simulator or do I have a coding error? I'm running simulator 0.6.1.1 on a mac.

 

 

Best Answer
1 BEST ANSWER

Accepted Solutions

The error message Cannot read property 'steps' of undefined implies that today.local is undefined. Normally the simulator gives a rising number of steps so there could be something wrong with your code.

 

Have you checked the requested permissions for 'Acitivity' inside the package.json?

And do you only have a problem with the simulator or on a device as well?

View best answer in original post

Best Answer
3 REPLIES 3

The error message Cannot read property 'steps' of undefined implies that today.local is undefined. Normally the simulator gives a rising number of steps so there could be something wrong with your code.

 

Have you checked the requested permissions for 'Acitivity' inside the package.json?

And do you only have a problem with the simulator or on a device as well?

Best Answer

Thanks @JeCom, dumb developer mistake. I created a variable today elsewhere in my code. Thanks for verifying the simulator didn't have a bug. Made look for the usual problem.... me.

Best Answer

No problem 🙂 It's easy to make silly mistakes, much harder finding out what is was 😛

Best Answer
0 Votes