Our app needs to read server settings that are configured in the app's settings. In iPadOS 17.7.7 specifically (iPadOS 17.7.6, iPadOS 18.5, and other versions works fine) one can't retrieve any setting from the settings bundle using:
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"setting_hostname"] != nil)
serverHostname = [[NSUserDefaults standardUserDefaults] objectForKey:@"setting_hostname"];
Also, when writing a custom value in NSUserDefaults like:
[[NSUserDefaults standardUserDefaults] setObject:@"Test" forKey:@"test"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSString* test = [[NSUserDefaults standardUserDefaults] objectForKey:@"test"];
NSLog(@"%@", test);
Shows an error in the console:
Couldn't write values for keys ( test ) in CFPrefsPlistSource<0x3017ecc60> (Domain: <redacted_bundle_id>, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting these preferences requires user-preference-write or file-write-data sandbox access
When closing the app and reopening it, and then reading the value of [[NSUserDefaults standardUserDefaults] objectForKey:@"test"];
returns null