I'm trying to add "properties" to categories using associate objects API.
objc_setAssociatedObject(self, &kIsAnimatingAssocObjKey, animating,
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
Xcode complains:
Implicit declaration of function 'objc_setAssociatedObject' is invalid in C99
and
Use of undeclared identifier 'OBJC_ASSOCIATION_RETAIN_NONATOMIC'
Xcode 4.5.2, iOS SDK 6 with deployment target 6. It does not work.
None of the articles on obj_assoc mention that I must import anything special.
只需导入运行时标头:
#import <objc/runtime.h>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.