Reputation: 851
I'm working with JSON and I errors code that I have to pass to my app and check it's value to tell the user what's wrong with his inputs so I have to take this error code and check it's value but my problem is that when I convert anyObject to NSNumber I get nil while the actual value (if I didn't convert the error code) isn't nil so is there any way to get the numbers from anyObject and pass it to an int variable ?!
Upvotes: 0
Views: 570
Reputation: 11555
You can get the integer value by using object.integerValue
. It returns an optional. Or you can use object as? Int
. Also returns an optional.
Upvotes: 1