isa is deprecated #79

trawor opened this Issue May 6, 2012 · 20 comments


None yet
trawor commented May 6, 2012

I got lots of warning like this: /PATH/JSONKit.m:2602:11: Direct access to objective-c's isa is deprecated in favor of object_setClass() and object_getClass()

My Xcode is up to 4.4 DP4


Same issue here, happened after upgrading.


Same issue on 4.4 DP5

tknizam commented Jun 13, 2012

This can be fixed by replacing




You will also need to replace








Thanks, When trying to replace I noticed this note on the file:

Why not just use object_getClass()? Because object->isa reduces to (typically) a single instruction. Calling object_getClass() requires
// that the compiler potentially spill registers, establish a function call frame / environment, and finally execute a "jump subroutine" instruction.
// Then, the called subroutine must spend half a dozen instructions in its prolog, however many instructions doing whatever it does, then half a dozen
// instructions in its prolog. One instruction compared to dozens, maybe a hundred instructions.
// Yes, that's one to two orders of magnitude difference. Which is compelling in its own right. When going for performance, you're often happy with
// gains in the two to three percent range.

Is it still O.K to change that ?

tknizam commented Jun 14, 2012

You can still keep using object->isa, but eventually that will be dropped as it is deprecated, unless there's a faster way to do the same thing without using object_getClass(), it is the next best solution for now.

If you still wish to use object->isa, you can suppress the warnings.

MSch commented Jun 14, 2012

Regarding the object->isa deprecation, once thing I'm not sure of:

Does isa return the NSNumber for the new NSNumbers that are implemented via tagged pointers? (AFAIK that's the reason isa is deprecated)

@johnezang johnezang closed this Jun 24, 2012
@johnezang johnezang was assigned Jun 24, 2012
drekka commented Aug 7, 2012

I was researching this issue and found which suggested to me that object_getClass() is no longer slower that isa.


Still produces a deprecation warning:

array->isa      = _CDVJKArrayClass;


dictionary->isa      = _CDVJKDictionaryClass;

Any good solution to this?


Same here!


Those aren't solutions, they just hide away the warnings. Good enough for a quick fix (I'm using it, so thanks), but nothing near a real solution.

marcdown commented Apr 1, 2013

Since none of the Pull requests have been accepted I applied the fixes @tknizam suggested as well as used object_setClass(object, Class) to fix @antonysastre's warnings. I also explicitly cast the appropriate format arguments as unsigned long to remove those warnings as well.
Forked repo:


@creativemess How do I reference your podspec?

marcdown commented Jun 6, 2013

@luketheobscure added the following to your Podfile:

pod 'JSONKit', :podspec => ''
jhonyf commented Oct 16, 2013

Not sure what happened to @marcdown gist, but recreated it to point to his fork. Use this in your podfile and run pod install

pod 'JSONKit', :podspec => ''

@jhonyf I updated my handle - here's the updated link:

pod 'JSONKit', :podspec => ''

Thanks marcdown. Current JSONKit is still build failing with deprecations but your fork worked great for me. Thanks for saving me doing it by hand. Yeah cocoapods!

xlarsx commented May 19, 2014

Thanks for the update!

@ArtSeo ArtSeo referenced this issue in ArtSeo/Multiples Jun 8, 2014

CocoaPods #5


@marcdown thanks a lot for that line! :)


i remove the jsonkit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment