What is the best way to handle boolean values obtained from a UISwitch parameter and stored in NSMutableDictionary, which is stored in the user directory as constant parameters? In particular, what is the best way to store boolean values other than numeric values in NSMutableDictionary that are written and read from the file system?
========
added: Thanks to Adrian and Ben. So the result is that if it is stored through [NSNumber numberWithBool:] (this is what I did), there is no convenient way to determine if this value occurred as a boolean, right?
The second part of this is that the NSMutableDictionary that I am storing is initially created by creating it using plist with boolean values. These values have the NSCFBoolean class on first read. My strategy now is to compare the meaning with which I work in the dictionary with the corresponding entry in plist.
The reason is that I generate interface elements on the fly to allow the user to manipulate these values, and I associate Boolean with UISwitch. If I lose the original class by converting it to a number, I get a non-local user interface element.
I consider replacing arrays as a stored value, where the first value is the stored value, and the rest of the entries are the choice: where the two options exist, they are considered logical ... in other cases, they serve as selection values. But it seems cumbersome if it is reliable.
Any ideas are welcome ...
source
share