• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSUserDefaults not sticking
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUserDefaults not sticking


  • Subject: Re: NSUserDefaults not sticking
  • From: Marco S Hyman <email@hidden>
  • Date: Wed, 10 Sep 2014 20:34:48 -0700

On Sep 10, 2014, at 8:19 PM, Charles Srstka <email@hidden> 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 (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


  • Follow-Ups:
    • Re: NSUserDefaults not sticking
      • From: Charles Srstka <email@hidden>
References: 
 >NSUserDefaults not sticking (From: "Rick C." <email@hidden>)
 >Re: NSUserDefaults not sticking (From: Graham Cox <email@hidden>)
 >Re: NSUserDefaults not sticking (From: "Rick C." <email@hidden>)
 >Re: NSUserDefaults not sticking (From: Graham Cox <email@hidden>)
 >Re: NSUserDefaults not sticking (From: "Rick C." <email@hidden>)
 >Re: NSUserDefaults not sticking (From: Kyle Sluder <email@hidden>)
 >Re: NSUserDefaults not sticking (From: Charles Srstka <email@hidden>)
 >Re: NSUserDefaults not sticking (From: Graham Cox <email@hidden>)
 >Re: NSUserDefaults not sticking (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: NSOutlineView
  • Next by Date: Re: NSUserDefaults not sticking
  • Previous by thread: Re: NSUserDefaults not sticking
  • Next by thread: Re: NSUserDefaults not sticking
  • Index(es):
    • Date
    • Thread