07-23-2018 15:46
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-23-2018 15:46
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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.
Accepted Solutions
07-24-2018 01:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-24-2018 01:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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?
07-24-2018 01:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-24-2018 01:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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?
07-24-2018 15:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-24-2018 15:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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.
07-24-2018 23:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

07-24-2018 23:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
No problem 🙂 It's easy to make silly mistakes, much harder finding out what is was 😛

