Free preview lesson
Why Your App Forgets Everything
See where your data lives right now
Why this matters: before you can keep your data, you need to know where it currently lives. In most beginner apps, the answer is memory.
Memory is temporary working space. When your app runs, it keeps things like lists, counters and text fields in variables and arrays. These are fast to use, but they only exist while the app is running.
To find where your data lives right now, follow these steps:
- Open your app's code and look for every variable or array that holds user information, such as a list of tasks or a name.
- For each one, ask: where does this value come from, and what happens to it if the app stops?
- Mark anything that is created when the app starts and never written anywhere else as memory-only.
- Notice which data the user typed in, since that is the data most worth keeping.
You will usually find that most of your app's data is memory-only. That is normal for a beginner project, and it is the reason your app seems to forget everything.
What to do now: open your project, list every array or variable that holds user data, and write next to each one whether it is memory-only.