> On Apr 4, 2021, at 4:50 AM, Mike Abdullah <mabdul...@karelia.com> wrote:
> 
>> From the docs - init returns an initialized NSUserDefaults object whose 
>> argument and registration domains are already set up. This method does not 
>> put anything in the search list. Invoke it only if you’ve allocated your own 
>> NSUserDefaults instance instead of using the shared one.
>> 
>> So it appears that using alloc int does not return the shared instance.
> 
> Where in the docs do you read that? The current NSUserDefaults docs say 
> contrary:


Sorry for the confusion. It is older 10.9 documentation for the init method. 
Apple depreciated initWithUser: and added initWithSuiteName: around this same 
timeframe.


> On Apr 4, 2021, at 12:15 AM, Jack Brindle via Cocoa-dev 
> <cocoa-dev@lists.apple.com> wrote:
> 
> Gabriel;
> 
> It appears you are trying to get NSUserDefaults to do something that Apple 
> doesn’t want it to do these days. Why not create your own defaults,
> writing the data to a dictionary that is then written to a file that you save 
> in the ~/Library/Preferences folder, with a name of your choice?
> 
> This does work in Big Sur, we use it ourselves. The down side is that you 
> don’t have the nice (and infuriating) caching of defaults that the system 
> provides.
> Note that the system will still create the standard user defaults file for 
> you, to save things like window positioning. But, you can save these things
> yourself in your own files. Just make sure you don’t use the same file name 
> as the system uses, or it will overwrite yours. You can modify it as you 
> suggested previously, though.


So Jack I am curious, do you use alloc then init or initWithSuiteName:nil or 
initWithSuiteName:@“mySuiteName" to create your own defaults?

--Richard Charles
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to