Re: Several different NSUserDefaults in the same app?

2021-04-02 Thread Sandor Szatmari via Cocoa-dev
Would suites work for you?

From the NSUserDefaults docs…

Maintaining Suites

- addSuiteNamed:
Inserts the specified domain name into the receiver’s search list.
- removeSuiteNamed:
Removes the specified domain name from the receiver’s search list.


Sandor Szatmari

> On Apr 2, 2021, at 17:05, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> I used to manage different NSUserDefaults in my app depending on which 
> monitor it runs.
> So, I create filenames of the user defaults like this:
>  NSString * defaults_name = [ NSString stringWithFormat:@"de.zach.MyApp.%@", 
> displayname ];
> 
> Then I used to create the NSUserDefaults object with an unusual approach,
> but that does not seem to work any more.
> 
> So, I am wondering, what is the correct and easy approach to managing 
> different user settings (user defaults)?
> 
> Note that my app is sandboxed, so the user defaults must go in 
>  ~/Library/Containers/de.zach.MyApp/Data/Library/Preferences/
> , must they not?
> 
> I looked at -initWithSuiteName , but it seems to me that is not they proper 
> approach, is it?
> 
> Thanks a lot in advance for all kinds of insights and help!
> 
> Best regards, Gabriel
> 
> 
> 
> ___
> 
> 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/admin.szatmari.net%40gmail.com
> 
> This email sent to admin.szatmari@gmail.com
___

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


Several different NSUserDefaults in the same app?

2021-04-02 Thread Gabriel Zachmann via Cocoa-dev
I used to manage different NSUserDefaults in my app depending on which monitor 
it runs.
So, I create filenames of the user defaults like this:
  NSString * defaults_name = [ NSString stringWithFormat:@"de.zach.MyApp.%@", 
displayname ];

Then I used to create the NSUserDefaults object with an unusual approach,
but that does not seem to work any more.

So, I am wondering, what is the correct and easy approach to managing different 
user settings (user defaults)?

Note that my app is sandboxed, so the user defaults must go in 
  ~/Library/Containers/de.zach.MyApp/Data/Library/Preferences/
, must they not?

I looked at -initWithSuiteName , but it seems to me that is not they proper 
approach, is it?

Thanks a lot in advance for all kinds of insights and help!

Best regards, Gabriel





smime.p7s
Description: S/MIME cryptographic signature
___

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