Is objc_setAssociatedObject not available in iOS?

ios, objective-c, objective-c-category, xcode

Solution

Simply import the runtime header:

`#import <objc/runtime.h>`

Problem

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.

Original source