FROM : Jaime Magiera
DATE : Thu Dec 19 20:49:32 2002
This is true. I have no idea why.
When I created a variable for NSUserdefaults, I had the same problem.
As soon as I accessed [NSUserDefaults standardUserDefaults] directly,
it updated. Can anyone shed light on why this would be so?
Also, there are problems if you've defined the key to be of one type,
then try to read/write as another. I had a problem between arrays and
single objects. I had to delete the key, then re-write it as the new
type I wanted.
Jaime
On Thursday, December 19, 2002, at 10:20 AM, Jonathan E. Jackel wrote:
> This may be way too obvious an answer, but I'll try it. It is not
> clear
> from the code below what "defaults" is. Have you tried substituting
> [NSUserDefaults standardUserDefaults] where you now have "defaults"?
>
> Jonathan
>
>
>> 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.
DATE : Thu Dec 19 20:49:32 2002
This is true. I have no idea why.
When I created a variable for NSUserdefaults, I had the same problem.
As soon as I accessed [NSUserDefaults standardUserDefaults] directly,
it updated. Can anyone shed light on why this would be so?
Also, there are problems if you've defined the key to be of one type,
then try to read/write as another. I had a problem between arrays and
single objects. I had to delete the key, then re-write it as the new
type I wanted.
Jaime
On Thursday, December 19, 2002, at 10:20 AM, Jonathan E. Jackel wrote:
> This may be way too obvious an answer, but I'll try it. It is not
> clear
> from the code below what "defaults" is. Have you tried substituting
> [NSUserDefaults standardUserDefaults] where you now have "defaults"?
>
> Jonathan
>
>
>> 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.
| Related mails | Author | Date |
|---|---|---|
| Eric Kolotyluk | Dec 19, 06:48 | |
| Vince DeMarco | Dec 19, 07:30 | |
| Andrew | Dec 19, 07:42 | |
| Angela Brett | Dec 19, 12:55 | |
| j o a r | Dec 19, 13:45 | |
| Malte Tancred | Dec 19, 14:20 | |
| Jonathan E. Jackel | Dec 19, 16:20 | |
| Jacques | Dec 19, 17:05 | |
| Eric Kolotyluk | Dec 19, 19:13 | |
| Eric Kolotyluk | Dec 19, 19:29 | |
| Douglas Davidson | Dec 19, 20:35 | |
| Jaime Magiera | Dec 19, 20:49 | |
| Andrew | Dec 20, 00:45 |






Cocoa mail archive

