Re: Preferences caching?
Re: Preferences caching?
- Subject: Re: Preferences caching?
- From: Charles Srstka <email@hidden>
- Date: Tue, 10 Dec 2013 13:17:56 -0600
On Dec 10, 2013, at 12:43 PM, Kyle Sluder <email@hidden> wrote:
> On Dec 10, 2013, at 10:38 AM, Charles Srstka <email@hidden> wrote:
>>
>> How about sandboxed applications? Their preference files are opaque to NSUserDefaults, and only sometimes visible to /usr/bin/defaults. How should one delete a corrupted plist file in a sandbox?
>
> Not sure what you mean by "opaque." If you mean that NSUserDefaults can't read from another app's sandbox, then that is obviously by design.
It makes sense that a sandboxed app wouldn't be able to read another sandboxed app's prefs. However, one would expect a non-sandboxed app to be able to read from anything on the system that the current user account has permissions to read.
Regardless of whether you disagree, the point was that NSUserDefaults/CFPreferences is not a good general-purpose solution to this.
> As far as defaults(1), that should always be able to find a sandboxed app's preferences. If it can't, file a bug.
I haven't had time to test this much in Mavericks, but in Mountain Lion, defaults(1) was inconsistent about this. For a sandboxed app, it would sometimes read from the app's sandbox, and sometimes it would read from the stub file in ~/Library/Preferences instead. Since the man page for defaults doesn't promise anything about being able to read from an app's sandbox, I was never sure whether the bug was that it doesn't always read sandboxed prefs, or that it ever does in the first place. Particularly if the NSUserDefaults thing is intentional and apps are not supposed to be able to read from other app's sandboxes, it seems odd to provide such an easy workaround.
Charles
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden