函数 objc_getAssociatedObject 的隐式声明在 C99 中无效

函数 objc_getAssociatedObject 的隐式声明在 C99 中无效

问题描述:

我正在尝试在我的 Objective-c 类别中使用关联对象,但收到此警告.

I'm trying to use Associated Objects on my objective-c category and I'm getting this warning.

Implicit declaration of function 'objc_getAssociatedObject' is invalid in C99

如果这有所不同,我也会使用 arc.

Also I'm using arc if that makes a difference.

你添加了吗

#import <objc/runtime.h>

在文件的开头?