Skip navigation.
 
mlRe: NSUserDefauts - Am I Missing the Obvious?
FROM : Eric Kolotyluk
DATE : Thu Dec 19 19:13:11 2002

Thanks Vince, that did the trick.

Also thanks to Andrew who told me to look in ~/Library/Preferences for
the .plist file, which reminded me to create the identifier string in
Project Builder so my defaults file would be named properly. When I
double click the .plist files, the Mac opens them automatically with
the Plist Editor, or you can inspect the XML with Text Edit.

Nice to have some help at the wee hours of the night (for me).

Cheers, Eric

On Wednesday, December 18, 2002, at 10:30  PM, Vince DeMarco wrote:

> Is this an in an Application or a foundation tool??
>
> In an Application
>
> - (BOOL)synchronize;
>
> on quit or when the application run loop fires
>
> after setting the default add this line
>
> [defaults synchronize];
>
> it should work then.
>
> vince
>
> On Wednesday, December 18, 2002, at 09:48  PM, Eric Kolotyluk wrote:
>

>> I do something like the following in my application
>>
>>  [defaults setObject:@"some string" forKey:@"myKey"];
>>
>> later after restarting the program, I do something like
>>
>>  NSString *myString;
>>  myString = [defaults objectForKey:@"myKey"];
>>  if (myString != nil)
>>  {
>>      // do something
>>  }
>>  else
>>      NSLog(@"myKey is missing");
>>
>> which logs "myKey is missing" every time. After reading the
>> documentation on User Defaults several times over I no grok. Is there
>> something I have to do in my application bundle before I can set
>> objects in the Application domain, or am I missing something more
>> basic? Where is the User Defaults dictionary stored? Is there some
>> way to inspect it?
>>
>> I'm an old NeXT developer from way back, but I'm having to learn a
>> few new tricks with Cocoa.
>>
>> Cheers, Eric
>> _______________________________________________
>> cocoa-dev mailing list | <email_removed>
>> Help/Unsubscribe/Archives:
>> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>> Do not post admin requests to the list. They will be ignored.

> _______________________________________________
> cocoa-dev mailing list | <email_removed>
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.

_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlNSUserDefauts - Am I Missing the Obvious? Eric Kolotyluk Dec 19, 06:48
mlRe: NSUserDefauts - Am I Missing the Obvious? Vince DeMarco Dec 19, 07:30
mlRe: NSUserDefauts - Am I Missing the Obvious? Andrew Dec 19, 07:42
mlRe: NSUserDefauts - Am I Missing the Obvious? Angela Brett Dec 19, 12:55
mlRe: NSUserDefauts - Am I Missing the Obvious? j o a r Dec 19, 13:45
mlRe: NSUserDefauts - Am I Missing the Obvious? Malte Tancred Dec 19, 14:20
mlRE: NSUserDefauts - Am I Missing the Obvious? Jonathan E. Jackel Dec 19, 16:20
mlRE: NSUserDefauts - Am I Missing the Obvious? Jacques Dec 19, 17:05
mlRe: NSUserDefauts - Am I Missing the Obvious? Eric Kolotyluk Dec 19, 19:13
mlRe: NSUserDefauts - Am I Missing the Obvious? Eric Kolotyluk Dec 19, 19:29
mlRe: NSUserDefauts - Am I Missing the Obvious? Douglas Davidson Dec 19, 20:35
mlRe: NSUserDefauts - Am I Missing the Obvious? Jaime Magiera Dec 19, 20:49
mlRe: NSUserDefauts - Am I Missing the Obvious? Andrew Dec 20, 00:45