NSUserDefaults using a persistant Domain in a StartUp Item...
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