UserDefaults not saving only on iOS 17

Hello. I'm experiencing some issues with my iOS application. We distribute our app through an enterprise plan, and our app is almost 8 years old. We've noticed that on iOS 17 devices, our UserDefaults files are not being saved in the Preferences folder. I've conducted research on this issue, and everywhere I looked, it indicated that the system should handle this saving process. Does anyone know what changes have been made in iOS 17 that prevent us from saving data in UserDefaults? I've tested it with a new app, and it worked perfectly fine.

Below are screenshots of the 'Preferences' folder on iOS 17 and 16.

I’d like to clarify the exact problem you’re seeing. Is it that your user defaults aren’t persisting? Or that they’re not being persisted in a specific file?

That is, if you save a user default and then read it back, do you actually get back the value you saved?

Share and Enjoy

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

No data is being persisted in UserDefaults.

In iOS 16, multiple files are created, some for our application and others for dependencies. In iOS 17, only the file with the bundle name is created, and in it, only the keys CKPerBootTasks and CKStartupTime are persisted. If I make a simple test call, for example: UserDefaults.standard.set("test", forKey: "test"), this value won't appear in the keys. But, i can read it from the memory, for some reason the keys are not saved on the plists.

I have already tried creating the PrivacyInfo file as described in the documentation, but it also didn't work.

I suspect it's some bug in iOS 17 that is affecting my app for some reason because it's very strange that it works fine on iOS 16 and stopped on 17.

I am having the same problem. UserDefaults values that were persistent under iOS 16 are not persistent under iOS 17.

Has anyone found a solution to this? Now I am finding that sometimes when my app reads a value from userdefaults it does not get the most recently saved value, but a previously saved value. Or sometimes I will get no value when I first attempt to read it, then the correct value if I try again several hours later. Do I need to look for a different way to persistently store values?

I had the same problem. How did it work out

I have same issue with iOS 17.2 and 17.3.1 on iPad, but on Mac it works fine. After relaunching application entries added by app are removed (entries exist and can be read while app is running).

UserDefaults not saving only on iOS 17
 
 
Q