JSONKit
JSONKit copied to clipboard
iOS 64 bit incompatibility
Unless I'm mistaken, JSONKit will not be able to compile when building iOS apps for 64 bit architectures, because the previously deprecated isa assignments are now completely removed.
You're not mistaken.
JSONKit.m:680:5: error: assignment to Objective-C's isa is deprecated in favor of object_setClass() [-Werror,-Wdeprecated-objc-isa-usage]
array->isa = _JKArrayClass;
^ ~~~~~~~~~~~~
object_setClass( , )
would replacing
array->isa = _JKArrayClass;
with
object_setClass(array, _JKArrayClass);
resolve the issue and work (as well of course doing the dictionary issue)?
Yes.
Cheers Bo98.
pull request anyone?
I believe the use of ISA assignment is done for speed reasons in this fork, and that's unlikely to change.
@farski but it's for speed reasons people are enabling 64-bit slices. I doubt keeping these few lines of purportedly 32-bit optimised code is worth the trade-off of disabling the 64-bit slice in its entirety! :)
There are lots of forks out there that have made the change, but as far as this one, I think @johnezang has said it's not going to change. Perhaps that has changed since it became a bigger issue with 64-bit, though.
Is it worth having an official 64bit optimised branch then? I can see a lot of people wanting this to get all the performance they can out of the 5S and iPad Air.
+1
I've switched my upstream repo to @mz2's master (incorporating #120) which addresses this issue.
Looks like this fork is currently unmaintained? #129
@farski the reason the isa pointer should not be assigned to directly any longer is actually performance: in the 64-bit runtime the isa pointer field holds the isa pointer... and "other runtime information" according to Apple's documentation. To be precise, 19 bits of the isa field go to holding the object's reference count inline which greatly speeds up reference counting in the common case where it fits in 19 bits (so by assigning to that field directly you could be messing with the object's retain count stored in those 19 bits of that address prior to your ->isa assignment). It would be trivial to make a preprocessor conditional to support both... but I doubt there'd be performance benefits really, presumably object_setClass is implemented as much more than an isa field assignment in the old runtime if that is what it does, and that should be inlining friendly. If you're worried of such an effect, showing it with a benchmark should be straightforward.
+1
Anyone have the fix?
Xcode has me manually fixing each of the lines.
You may also have a look at #158.
Missing 64-bit support - Beginning on February 1, 2015 new iOS apps submitted to the App Store must include 64-bit support and be built with the iOS 8 SDK. Beginning June 1, 2015 app updates will also need to follow the same requirements. To enable 64-bit in your project, we recommend using the default Xcode build setting of “Standard architectures” to build a single binary with both 32-bit and 64-bit code.
@9cat Is it still missing 64 bit support?