On Sep 10, 2014, at 8:19 PM, Charles Srstka <cocoa...@charlessoft.com> wrote:

> 
>> Where did you get the idea that NSUserDefaults doesn't work for sandboxed 
>> apps? It certainly does.
> 
> #import <Foundation/Foundation.h>
> 
> int main(int argc, const char * argv[]) {
>    @autoreleasepool {
>        NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
>        NSDictionary *domain = [def 
> persistentDomainForName:@"com.apple.TextEdit"];
> 
>        NSLog(@"%@", domain);
>    }
>    return 0;
> }

Ahh, you want to read defaults for some other app.   Nope.  Can't
do that.   Says so right in the doc:

Sandbox Considerations
A sandboxed app cannot access or modify the preferences for any other app. (For 
example, if you add another app's domain using theaddSuiteNamed: method, you do 
not gain access to that app's preferences.)

Attempting to access or modify another app's preferences does not result in an 
error, but when you do, OS X actually reads and writes files located within 
your app's container, rather than the actual preference files for the other 
application.




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to