Pranav Wadhwa desires to attract extra consideration to this query.
I’m utilizing a consumer default values to look at notification preferences. I print the worth on app launch:
func software(_ software: UIApplication, didFinishLaunchingWithOptionslaunchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
print(“notifications are initially (UserDefaults.customary.bool(forKey: UserDefaults.Keys.notificationsEnabled))”)
}
And on app termination:
func applicationWillTerminate(_ software: UIApplication) {
print(“notifications are lastly (UserDefaults.customary.bool(forKey: UserDefaults.Keys.notificationsEnabled))”)
}
This works advantageous more often than not, however often the worth simply resets to what it was initially:
notifications are initially false
**replace notifications to true then drive stop app**
notifications are lastly true
**reopen app**
notifications are initially false
I’ve spent hours debugging this and can’t determine why. It really works a number of instances in a row appropriately and can often revert again to this for some unknown motive. I attempted setting the UserDefault values on the primary thread as properly, however that does not appear to alter something. Has anybody seen this bug earlier than? If that’s the case, how can I resolve this situation?