As I understood after digging the docks on the network, the values ​​set in the Settings Bundle can be obtained through [ NSUserDefaults standartDefaults ].

What is the syntax of addressing a value using the example of the Toggle Switch ?


Found that the key goes as follows:

 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; toggleSwitchValue = [defaults objectForKey:@"PSToggleSwitchSpecifier"]; 

In this version, toggleSwitchValue type id and not BOOL as specified in the documentation. How to work with it to get its value?

    1 answer 1

    The syntax there is as close as possible to NSMutableDictionary, except for objects there can be primitives like [pref boolForKey:@"MyKey"] (pref is a variable to which standartDefaults was returned, without it, in principle, this is still Singleton), what exactly you do not know the key. The only thing - do not forget to jerk synchronize before reading \ after writing new values


    "in this variant toggleSwitchValue of type id and not BOOL as indicated in the documentation. How to work with it correctly to get its value?"

    Something like:

     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSNumber *toggleSwitchValue = [defaults objectForKey:@"PSToggleSwitchSpecifier"]; BOOL boolToggle=[toggleSwitchValue boolValue]; 

    But was it possible to determine exactly Blvd in this bandle, I don’t remember. You can do it manually, somehow I rarely use system settings.

    • I will try to implement it so, thank you for the option! - AlexThumb