• 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
NSUserDefaults using a persistant Domain in a StartUp Item...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSUserDefaults using a persistant Domain in a StartUp Item...


  • Subject: NSUserDefaults using a persistant Domain in a StartUp Item...
  • From: "Nick Gauthier" <email@hidden>
  • Date: Sat, 16 Sep 2006 20:25:00 -0400

Hi

I have writtin a foundation tool which needs to read certain user
defaults. The user defaults are set up as a persistant domain called
com.SSS.CPUThrottler2. Setting and changing these defaults from user
land works no problem, but I am unable to convince my startup item
foundation tool to read them. The tool needs to run as root (it
changes some sysctls), but it seems that this is preventing it from
correctly identifying my defaults. How can i force the foundation tool
running as root to look at my persistant domain? Here is the relevent
code: (The app runs as a backround daemon running an infinite loop and
needs to check these values every iteration (approximatly one
second)).

while(1)
	{
		//update all needed variables
		defaults = [[NSUserDefaults standardUserDefaults]
persistentDomainForName:@"com.SSS.CPUThrottler2"];
		[[NSUserDefaults standardUserDefaults] synchronize];
		manFreqBat = [[defaults objectForKey:@"manualFrequencyForBattery"] intValue];
            ACProfile = [defaults objectForKey:@"profileSelectedAC"];

            //do something with these values



           usleep(100000);
     }


My problem is that this is apparently not working. The userDefaults are not read and i do not understand why. Does anyone have any idea how I might go about fixing this?

thanks
-SaberSHO
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Binding to NSTextView
  • Next by Date: Capturing keyboard input, including hotkeys
  • Previous by thread: Re: Stealing keystrokes
  • Next by thread: Capturing keyboard input, including hotkeys
  • Index(es):
    • Date
    • Thread