See my above comments above. Above approach might fix your issue.
Post
Replies
Boosts
Views
Activity
I also observed the same and it fixed the issue after I moved the API call to didFinishLaunching
please make sure to call UserDefaults only after - appDidFinishLaunching. If you still see the issue and are using UserDefaults.standard, then try creating a new instance of UserDefaults with your own suitename and use that instead of standard UserDefaults.