Last Updated: February 25, 2016
·
1.636K
· fousa

Fix JSONKit Xcode 4.6 warnings

I use JSONKit in some older projects and since the last version of Xcode (4.6 that is) some depreciation warnings always came up.

And I HATE these kind of warnings.

What to do?

You can do 2 things:

  • Use the new ‘NSJSONSerialization‘ class available in iOS 5
  • Correct the code in JSONKit
  • Ignore the warnings with some directives

Code correction

Replace the following lines in the JSONKit.m file:

array->isa = _JKArrayClass;
dictionary->isa = _JKDictionaryClass;

by:

object_setClass(array, _JKArrayClass);
object_setClass(dictionary, _JKDictionaryClass);

And done!