mirror of
https://github.com/LiveContainer/LiveContainer.git
synced 2026-04-25 09:05:53 +03:00
[GH-ISSUE #149] [BUG] NSUserDefaults are not written to App's respective directories #137
Labels
No labels
bug
compatibility
enhancement
multitasking
pull-request
safe area
status: broken
status: usable
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/LiveContainer#137
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hugeBlack on GitHub (Sep 2, 2024).
Original GitHub issue: https://github.com/LiveContainer/LiveContainer/issues/149
Describe the bug
I found that although apps write almost all their files to their respective folders, their NSUserDefaults are still written to LiveContainer's
Library/Preferences, which creates a mess in that folder and is hard for users to move apps to other devices.I wander if it's possible to redirect NSUserDefaults writes to some folder in Document?
Instructions to reproduce
Install any app that uses NSUserDefaults and check LiveContainer's
Library/PreferencesWhat version of LiveContainer are you using?
2.1.2
Other info
I dumped symbols of NSUserDefaults class and didn't find any way to set a path. I wonder if it's hard coded into that class, or it uses a different environment variable other than
HOME?I also tried to create a symlink but iOS didn't allow any write to
Library/Preferencesfolder it self.There is a method caller
-[NSUserDefaults _initWithSuiteName:container:]but it seems that not allNSUserDefaultsare instantiated by this method.@hugeBlack commented on GitHub (Sep 3, 2024):
I found a method
-[NSUserDefaults _container]that I can hook to redirect mostNSUserDefaultswrite to other location, but some still write directly toLibrary/Preferences