App Group container being recreated on app update, causing complete data loss

I'm experiencing an issue where the App Group shared container appears to be recreated (with a new creation date) during an app update, resulting in complete loss of locally stored data.

Background

My app uses UserDefaults, Realm, Core Data, and CloudKit, with all local data stored in the App Group container (FileManager.containerURL(forSecurityApplicationGroupIdentifier:)). The app has been available since 2016 and has a stable user base.

Starting last year, I began receiving occasional reports from users saying all their data in the app had disappeared. To investigate, I added diagnostic logging that detects when an existing user's data appears to have been reset — specifically by checking the App Group container's file system creation date, and the existence and values of expected files.

What the diagnostics revealed

When the issue occurs, I observe the following:

  • The App Group container has a recent creation date, far newer than the user's first launch date
  • The Core Data store file's creation date is also immediately after the App Group container's recreation date
  • I write the same values to both standard UserDefaults and the App Group version (UserDefaults(suiteName:)). Only the App Group version is reset — the standard side retains historical data
  • The standard side still holds firstLaunchDate, initialVersion, and launchCount, confirming this is not a fresh install

Here is a sample diagnostic log from an affected user:

appGroupContainerCreationDate: 2026-03-30T18:44:10Z

firstLaunchDate: 2025/01/05 4:00

initialVersion: 10.8.0

currentAppVersion: 10.14.14

previousVersion: 10.10.0

launchCount: 44

availableStorageMB: 46646

The container creation date (2026-03-30) is clearly inconsistent with the user's first launch date (2025-01-05) and launch count (44). The container creation date is obtained with the following code:

  let appGroupURL = FileManager.default.containerURL(                                                                                                                                                                                                         
      forSecurityApplicationGroupIdentifier: "group.xxx.xxx"
  )!
  let attributes = try? FileManager.default.attributesOfItem(atPath: appGroupURL.path)                                                                                                                                                                        
  let containerCreationDate = attributes?[.creationDate] as? Date

Scale and pattern

  • Reports began increasing in late November last year
  • Over 85% of affected cases are on iOS 26
  • Most affected devices have plenty of available storage (46GB+ in the example above)
  • This is likely occurring during a normal app update (not a fresh install or device restore)

Ruled-out hypotheses

  • Not a fresh install — firstLaunchDate, initialVersion, and launchCount are preserved in standard UserDefaults
  • Not a storage issue — affected users typically have tens of GBs of free space, making it unlikely that iOS purged the data due to low storage
  • Not an app-side code change — the App Group identifier and entitlements have not been changed
  • Not triggered by silent notifications, background tasks, or widget activity — these processes do write to the App Group container, but the recreation does not appear to occur immediately after any of these operations

Questions

  1. Has anyone else observed App Group containers being recreated (new creation date, empty contents) during a standard app update?
  2. Is there a known iOS behavior or bug that could cause this, particularly on iOS 26?
  3. Are there any recommended mitigations?

Any insight would be greatly appreciated. This is a data loss issue affecting real users, and I'd like to understand whether this is an iOS-level problem or something I should be handling differently on my end.

Answered by DTS Engineer in 882590022

I’m not aware of any known issue that matches these symptoms. As you’ve noted, iOS is expected to preserve app group containers across OS and app installs. This certainly works for most apps and most users, but that doesn’t preclude there being a bug that causes this problem for some users of some apps.

To investigate this we need to see a sysdiagnose log taken immediately after the user notices the problem. That’s gonna be tricky to acquire given that this problem isn’t obviously reproducible. I have a bunch of background on this in Using a Sysdiagnose Log to Debug a Hard-to-Reproduce Problem.

Key to that process is the ability to quickly and reliably identify that the problem has occurred. If I were in your shoes I’d add specific code for that, code that’s not tied to UserDefaults or Core Data. Both of those are big, complex subsystems, which makes it hard to know whether you’re hitting a problem with that subsystem or something more fundamental.

Rather, I recommend that you store this state in files that you control. You could, for example, store a pair of ‘canary’ files, one in your app’s container and one in the app group container. If the second canary is missing but the first one is present, you know that the app group container has disappeared unexpectedly, and you can take action from there.

And I think this technique will scale to all users of the container. For example, in an app extension, it’s fine if the app group container canary is present but the app extension canary is missing.

Share and Enjoy

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

I’m not aware of any known issue that matches these symptoms. As you’ve noted, iOS is expected to preserve app group containers across OS and app installs. This certainly works for most apps and most users, but that doesn’t preclude there being a bug that causes this problem for some users of some apps.

To investigate this we need to see a sysdiagnose log taken immediately after the user notices the problem. That’s gonna be tricky to acquire given that this problem isn’t obviously reproducible. I have a bunch of background on this in Using a Sysdiagnose Log to Debug a Hard-to-Reproduce Problem.

Key to that process is the ability to quickly and reliably identify that the problem has occurred. If I were in your shoes I’d add specific code for that, code that’s not tied to UserDefaults or Core Data. Both of those are big, complex subsystems, which makes it hard to know whether you’re hitting a problem with that subsystem or something more fundamental.

Rather, I recommend that you store this state in files that you control. You could, for example, store a pair of ‘canary’ files, one in your app’s container and one in the app group container. If the second canary is missing but the first one is present, you know that the app group container has disappeared unexpectedly, and you can take action from there.

And I think this technique will scale to all users of the container. For example, in an app extension, it’s fine if the app group container canary is present but the app extension canary is missing.

Share and Enjoy

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

App Group container being recreated on app update, causing complete data loss
 
 
Q