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.
Answered! Go to the Best Answer.
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?
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?