Post

Replies

Boosts

Views

Activity

Reply to UserDefaults not persisting data
Sorry, I guess context would have been applicable "MyAppSettingsResetState" is a toggle on the settings page of our app so it would be true if a user had gone into the settings page and logged out. I've since discovered the cause of my issue here and its actually related to that setting. Basically it was just a programming error on my part for an edge case. It was happening if the user had given notification permissions, logged out then opened the app again. registerForRemoteNotifications() was still being called and in the didRegisterForRemoteNotificationsWithDeviceToken we send the APN token to our server which obviously fails because the user had logged out and no longer has a valid session. Then upon the Auth error our SDK was clearing its cache and clearing all the UserDefaults.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’21