我想检查对象(例如someObject)是否可分配(可铸造)到另一种类型的变量(例如SpecifiedType).在Java中,我可以写:
someObject instanceof SpecifiedType
Run Code Online (Sandbox Code Playgroud)
一个相关的问题是查找对象的运行时类型是否等于另一种类型.在Java中,我可以写:
someObject.getClass().equals(SpecifiedType.class)
Run Code Online (Sandbox Code Playgroud)
如何在Objective-C中完成?