Question

OK, I'm using a JSON-enabled Rails web-service to provide data to an iPhone application. I'm finding my Integer values (IDs) are being interpreted by the json-framework as a NSDecimalNumber type. I need it as an integer. How can I get an integer value out of my NSDecimalNumber typed variable? I have tried everything I know, and I'm at my wits end.

Was it helpful?

Solution

I'm not sure about JSON, but:

NSDecimalNumber inherits from NSNumber, so you could just use the NSNumber's -integerValue method.

Requires 10.5, but shouldn't be an issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top