如何使用objc_method_family注释目标 c 属性



如果我有一个名为 initFoo 的属性,我如何使用 objc_method_family(none) 对其进行注释,以便在 ARC 下编译它时不会收到Init Methods must return a type related to the received type错误:

@property NSString *initFoo __attribute__((objc_method_family(none)));

不起作用,并将返回神秘的9 attribute only applies to void*错误。

正常声明属性,然后使用注释为其声明一个访问器。


@property NSString *initFoo; - (NSString *)initFoo __attribute__((objc_method_family(none)));

最新更新