Skip to content

[BUG] NSUserDefaults are not written to App's respective directories #149

@hugeBlack

Description

@hugeBlack

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/Preferences

What 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/Preferences folder it self.

There is a method caller -[NSUserDefaults _initWithSuiteName:container:] but it seems that not all NSUserDefaults are instantiated by this method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions