I’m using class_getProperty() in my iPad app. I tried #import <objc/objc-runtime.h>, which works on iPad simulator.
But when I try to run it on my iPad, Xcode says:
objc/objc-runtime.h: No such file or directory
and
warning: implicit declaration of function ‘class_getProperty’.
Please note that there are differences between the simulator and the device. The simulator does not run the exact same SDK as the device. The lower layers are from the Mac SDK actually, which makes sense since it’s executed on a mac.
However, it seems there is a fix for your specific problem. You should definitely try the fix Jeff Lamarche describes in this post: Device vs. Simulator
Replace
By
Then to get rid of the warning, you add these two lines in the header file of the involved class :
And then in the implementation file :