Got Unrecognized selector -replacementObjectForKeyedArchiver: crash when implementing NSCoding in Swift Got Unrecognized selector -replacementObjectForKeyedArchiver: crash when implementing NSCoding in Swift ios ios

Got Unrecognized selector -replacementObjectForKeyedArchiver: crash when implementing NSCoding in Swift


Although Swift class works without inheritance, but in order to use NSCoding you must inherit from NSObject.

class Command: NSObject, NSCoding {    ...}

Too bad the compiler error is not very informative :(