> On Apr 3, 2021, at 9:56 AM, Gabriel Zachmann wrote:
>
> Sorry for asking: the shared instance is the one that is persistent, right?
Looks like an instance created from alloc init would not be useful in your
situation. It appears you would be in charge of persistence.
NSUserDefault ,
Gabriel
> On Apr 3, 2021, at 10:55, Gabriel Zachmann wrote:
>
>
>>
>>>
>>> [ [NSUserDefaults userDefaultsWithName:@"monitor-name"] boolForKey:@"some
>>> key"]
>>
>> I thought -addSuiteNamed: would allow you to maintain/add a suite of
>> defaults for each monitor.
>
> Maybe.
>
> The
> On Apr 3, 2021, at 12:00, Gabriel Zachmann via Cocoa-dev
> wrote:
>
> Oh, and BTW: what happens if I do this:
>
>NSDictionary * monitor_user_defaults = [ [NSUserDefaults standardDefaults]
> dictionaryForKey: displayName_];
>[monitor_user_defaults setObject: anArray forKey:
Oh, and BTW: what happens if I do this:
NSDictionary * monitor_user_defaults = [ [NSUserDefaults standardDefaults]
dictionaryForKey: displayName_];
[monitor_user_defaults setObject: anArray forKey: @"Pref1"];
Will that make NSUserDefaults automagically write the new preferences/defaults
> On Apr 3, 2021, at 11:02, Gabriel Zachmann via Cocoa-dev
> wrote:
>
>
>>
>> Why not use your top level NSUserDefaults as a dictionary and use each
>> monitor name as a key for each object in the dictionary? Is that too clunky?
>
> I was thinking of that, but I was hoping for a more
> Why not use your top level NSUserDefaults as a dictionary and use each
> monitor name as a key for each object in the dictionary? Is that too clunky?
I was thinking of that, but I was hoping for a more elegant solution.
With the dictionary-per-monitor your suggesting,
I guess I would have
>> Can you explain to me, what is the difference between
>> [[NSUserDefaults alloc] init]
>> and
>> [NSUserDefaults standardDefaults]
>> ?
>> I didn't get that from Apple's docs.
>>
>
>
> [...]
> So it appears that using alloc int does not return the shared instance.
Sorry for asking: the
> On Apr 3, 2021, at 8:59 AM, Gabriel Zachmann wrote:
>
> Thanks a lot for your response!
>
>> How about something like this?
>>
>>NSUserDefaults *monitor1 = [[NSUserDefaults alloc] init];
>>[monitor1 setBool:YES forKey:@"MyKey”];
>>
>>BOOL value = [monitor1 boolForKey:@"MyKey"];
Why not use your top level NSUserDefaults as a dictionary and use each monitor
name as a key for each object in the dictionary? Is that too clunky?
https://developer.apple.com/documentation/foundation/nsuserdefaults
A default object must be a property list—that is, an instance of (or for
Thanks a lot for your response!
> How about something like this?
>
> NSUserDefaults *monitor1 = [[NSUserDefaults alloc] init];
> [monitor1 setBool:YES forKey:@"MyKey”];
>
> BOOL value = [monitor1 boolForKey:@"MyKey"];
So, where is the kind of monitor encoded?
I mean, how does the
>>
>> [ [NSUserDefaults userDefaultsWithName:@"monitor-name"] boolForKey:@"some
>> key"]
>
> I thought -addSuiteNamed: would allow you to maintain/add a suite of defaults
> for each monitor.
Maybe.
The doc says:
"""
The suiteName domain is similar to a bundle identifier string, but isn't
> On Apr 3, 2021, at 5:40 AM, Gabriel Zachmann via Cocoa-dev
> wrote:
>
> But what I would like to have is a mechanism that lets me manage different
> user defaults when the app is running on different monitors.
> Something like
>
> [ [NSUserDefaults userDefaultsWithName:@"monitor-name"]
Gabriel,
> On Apr 3, 2021, at 07:41, Gabriel Zachmann via Cocoa-dev
> wrote:
>
> Thanks a lot for your response!
>
>> User Defaults are now stored in an opaque in memory DB, and while the
>> various files may still play a role, you can't make any assumptions about
>> them anymore.
>
>
Thanks a lot for your response!
> User Defaults are now stored in an opaque in memory DB, and while the various
> files may still play a role, you can't make any assumptions about them
> anymore.
Yes, I understand that.
>
> That being said, [NSUserDefaults.standardUserDefaults
14 matches
Mail list logo