In my iPhone app I employ NSDecimalNumber
to store some some currency rate values.
I pull the data from the web the first time the app is launched and then again when they become obsolete, and I store them in a NSDictionary
; then I use writeToFile:atomically:
.
When the app is launched for the first time, my rate conversion method works allright. Yet, when I launch the app a second time, and the rates get loaded with -(NSDictionary*) initWithContentsOfFile:
the conversion methos stops working, and I get weird results.
I did some debug with breakpoints in the incriminated method, and I found out that the rates data are seen as NSCFNumber
, rather than as NSDecimalNumber
. So it appears that initWithContentsOfFile
doesn't assign the right class to my objects. For the record, the actual value of these objects, as shown in the description
method, corresponds to the expected rate value.
I also checked the plist file generated by writeToFile:atomically:
, and saw that the rates are stored as real
; I wonder whether this is the right type.
Any idea of whats going on?
Thanks in advance,
Davide