(macOS) How to remain data when delete the app from the launchpad

My electron app was just distributed to the Mac App Store and can be successfully installed.

However, when I delete the app from the launchpad, I find out that the folder in the file path "~/Library/Containers/my_app_name/" is also been deleted.

My goal is to preserve the data when users delete the app, so that users can keep on using when they reinstall the app. But I cannot find out a solution.

I'm asking how can app remain its data when it is deleted?
Is there any idea or guide information?
Thanks!

Replies

However, when I delete the app from the launchpad, I find out that the folder in the file path ~/Library/Containers/my_app_name/ is also been deleted.

That’s not my experience. Unlike iOS, macOS does not delete an app’s container when you delete the app.

I actually tested this here in my office, just to be sure. Here’s what I did:
  1. I installed Grand Perspective from the App Store.

  2. I ran it, and changed a preference.

  3. I deleted the app.

  4. I re-installed it.

  5. I ran it again and confirmed that the preference was set as per step 2.

I ran the experimental twice, changing how I deleted the app in step 3 — in one case I deleted it from the Finder and in the other case from Launchpad — and the results were the same each time.

How did you test this?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"