I'm stuck on a weird problem. I'm parsing a JSON response via Alamofire, and want to fetch a variable that just keeps throwing errors regardless whether I cast it to a String or Number, whilisting changing the error message every time I do :/ If I cast it to a String like this:
let kolicina = jsonCategory["kolicina"] as! String
if Int(kolicina) > 0 {
I get the error:
"Could not cast value of type '__NSCFNumber' (0x10f051368) to 'NSString' (0x10e627b48)."
When I try to cast it to a NSNumber:
let kolicina = jsonCategory["kolicina"] as! NSNumber
if kolicina.integerValue > 0 {
I get:
"Could not cast value of type 'NSTaggedPointerString' (0x10effcae8) to 'NSNumber' (0x10e5d32a0)."
This is what I get for that specific variable when I print the Dictionary:
kolicina = 0;
Can someone point me in the right direction?