Post

Replies

Boosts

Views

Activity

Reply to Lost data in UserDefaults
Similar issue here, as we have a mature application running already for several years. After iOS 15 was released some first reports came in that the prescriber (medical user) needed to recertify that (s)he was allowed to prescribe medicine. Once completed the settings are stored in the standardUserDefaults. - (instancetype)init {   self = [super init];   if(!self) return nil;   NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];    _name  = [ud stringForKey: kName]; ...  isDirty = NO;       return self; } During the didFinishLaunchingWithOptions function there are settings loaded for reporting amongst others which call for retrieving the standardUserDefaults. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {   [[IQKeyboardManager sharedManager] setEnable:YES];    [self xxxx:launchOptions];    return YES; } Following then the execution path it eventually end up at: [xxxx sessionProperties:[Settings userData]]; which then calls the init function containing the [NSUserDefaults standardUserDefaults]; To answer eskimo's question: And now my questions: Does your app have the Data Protection Entitlement entitlement (com.apple.developer.default-data-protection) set? If so, what to? Yes, NSFileProtectionComplete is configured. Now the question arises where to move the app initialization functions to... :-)
Topic: App & System Services SubTopic: General Tags:
Jan ’22
Reply to Lost data in UserDefaults
Similar issue here, as we have a mature application running already for several years. After iOS 15 was released some first reports came in that the prescriber (medical user) needed to recertify that (s)he was allowed to prescribe medicine. Once completed the settings are stored in the standardUserDefaults. - (instancetype)init {   self = [super init];   if(!self) return nil;   NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];    _name  = [ud stringForKey: kName]; ...  isDirty = NO;       return self; } During the didFinishLaunchingWithOptions function there are settings loaded for reporting amongst others which call for retrieving the standardUserDefaults. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {   [[IQKeyboardManager sharedManager] setEnable:YES];    [self xxxx:launchOptions];    return YES; } Following then the execution path it eventually end up at: [xxxx sessionProperties:[Settings userData]]; which then calls the init function containing the [NSUserDefaults standardUserDefaults]; To answer eskimo's question: And now my questions: Does your app have the Data Protection Entitlement entitlement (com.apple.developer.default-data-protection) set? If so, what to? Yes, NSFileProtectionComplete is configured. Now the question arises where to move the app initialization functions to... :-)
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Lost data in UserDefaults
There is also a follow up question which is probably more important; How can this be debugged? How to configure XCode with breakpoints to see how the prewarm is taking place and which calls it makes?
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’22