简体   繁体   English

如何获取NSArray或NSSet的类名/存储类型?

[英]How to get Class Name/Storage type of NSArray or NSSet?

I want to get the storage type of NSArray or NSSet. 我想获取NSArray或NSSet的存储类型。

For example I defined the property: 例如,我定义了属性:

@property (nonatomic, retain) NSSet <TestClass > testComments;

Now I want to get name of class (TestClass) of NSSet. 现在,我想获取NSSet的类(TestClass)的名称。 Please help me to achieve this. 请帮助我实现这一目标。

Thanks. 谢谢。

It's not possible. 这是不可能的。 Like Java, Objective-C's generics support is compile-time-only. 像Java一样,Objective-C的泛型支持也是仅编译时的。 They are little more than glorified annotations to help the Swift compiler, and the warnings generated by clang are really incidental. 它们不过是美化了注释以帮助Swift编译器而已,而clang生成的警告确实是偶然的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM