Could not cast value of type ‘NSTaggedPointerString’ to ‘NSNumber’

The reason of the error is jsonDict["totalfup"] is a String (NSTaggedPointerString is a subclass of NSString) , so you should convert String to Double.

Please make sure, catch exception and check type before force-unwrap !

totalData = (jsonDict["totalfup"] as! NSString).doubleValue

For safety, using if let:

// check dict["totalfup"] is a String?
if let totalfup = (dict["totalfup"] as? NSString)?.doubleValue {
  // totalfup is a Double here 
}
else {
  // dict["totalfup"] isn't a String
  // you can try to 'as? Double' here
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)