I'm working on a macOS and iOS app using SwiftUI. And received bug from very few user that they are being logged out, even tho they didn't.
So i'm assuming issue is relevant to this forum post, and that the keychain data and user defaults aren't available very early on in an app's lifecycle (presumably from cold start).
There is fix available for iOS but didn't find anything relevant to isProtectedDataAvailable for macOS.
I'm accessing UserDefaults in my @main view's sub view. It seems that UserDefaults is accessed too early, before applicationDidFinishLaunching.
And therefore, not getting user data on launch sometimes.
This issue is very rare, i'm not able to reproduce this, but assuming this can be cause based on some form post, also because view's onAppear calls before applicationDidFinishLaunching.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm building a document-based app using SwiftUI's DocumentGroup with a ReferenceFileDocument. Everything works well when documents are created in the "On My iPhone" directory — they save(After registering Undo action), even after renaming.
However, when I create a document inside iCloud Drive (by default it creates in iCloud Drive as iCloud sync is enabled in capabilities), the document:
✅ Saves properly before rename
❌ Stops saving changes after renaming the file (By taping the filename at the top of the screen When document is open(Using inline rename UI in the navigation bar))
This issue only occurs for iCloud Drive–based documents. The same rename flow works fine for locally stored documents.
How can i ensure the document continues saving properly in this case?
Topic:
Community
SubTopic:
Apple Developers