Abu Eesa Abu Eesa - 1 year ago 104
Objective-C Question

Int64 can't be converted if store in Realm

I need to save 11 digits number in Realm, for that am using

When am reading it I need to convert it's datatype to

let icnStr = employeeObj["icn"] as! String

but it is showing following error.

Could not cast value of type '__NSCFNumber' (0x186d21c) to 'NSString' (0xefd5e4).

Answer Source

Try String(employeeObj["icn"]), hope it help, dont downcast it but create String instance with value of the Int

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download