Shared container persists across installs

Hi -

Our iOS application uses a shared container to store data so that it is accessible by the main app as well as several app extensions (widgets, share action, watch app, notification service, etc.)

I've noticed on a few devices that the shared container is persisting after the app is uninstalled and reinstalled. The URL for the shared container has a unique UUID that I can see is the same across installs, and files that were saved to it are still there.

Most devices behave as I would expect: they lose the contents of the shared container, and get a brand new empty container on reinstall.

The problem doesn't seem to be iCloud as I have completely disabled iCloud access on the test devices and the folder continues to persist.

Has anyone else experienced this, and is there a way to ensure that the shared container is deleted when the app is uninstalled?

Thanks, Brent

Post not yet marked as solved Up vote post of Brent_Newman Down vote post of Brent_Newman
2.3k views

Replies

The most common cause for this is that a second app on the device references the same app group, and hence its shared container. Are you sure that’s not the case here?

Share and Enjoy

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

I do have one test app that uses the same shared container, but it's never been installed on most of the devices where I am witnessing this behavior. Also, I would expect that removing all apps that reference a common shared container would remove the container but that is not happening here. Once the device gets into this state, the shared container is never removed.

I've only witnessed this happening on iOS 16.

Is there anything else you can think of that might be causing this?

Is there anything else you can think of that might be causing this?

Nope. If you’ve deleted all the apps using the shared container and the container doesn’t go away, that seem eminently bugworthy to me. I recommend that you include three sysdiagnose logs:

  • One taken before you delete the last app that uses the container.

  • Another taken after deleting that app.

  • A third taken after re-installing the app and confirming that the container is still present.

Also include a rough timeline of all the relevant events.

Share and Enjoy

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

Thanks! I've logged a bug for this:

FB11844942 (Shared App Container persists across installs)

which includes the suggested sysdiagnose logs for each step.

Add a Comment

Any progress with this? We've encountered similar behavior when using shared container.