Original URL: http://blog.devtang.com/2012/05/05/do-not-use-sbjson/
I do not know why, in iOS development, many people use Sbjson (also known as json-framework) to do JSON parsing library. I think this is because Sbjson is the first JSON parsing library to appear on iOS. But with the popularity of iOS development, more and more excellent JSON parsing library has emerged, Sbjson and they compared to the performance of a large gap.
Now the main popular JSON parsing libraries in the iOS industry are:
Nsjsonserialization,
Apple JSON,
Touchjson,
Sbjson,
YAJL,
Jsonkit
These libraries have been benchmark tested by many peers in the industry. The test articles I searched for online include:
- Https://github.com/samsoffes/json-benchmarks
- http://blog.csdn.net/arthurchenjs/article/details/7009995
- http://blog.csdn.net/ccat/article/details/7207871
- http://omegadelta.net/2011/11/04/json-framework-now-sbjson-is-evil/
- Http://stackoverflow.com/questions/2256625/comparison-of-json-parser-for-objective-c-json-framework-yajl-touchjson-etc
is one of the benchmark test results graphs that I intercepted from Arthurchenjs's blog post (the shorter the bar, the faster the resolution):
As you can see from these articles, Sbjson in most tests is the first or penultimate position in the countdown. So, Sbjson actually in the performance of this point, is really very "SB", it is not worth a souvenir. Quickly change your JSON parsing library to something else!
So which one should I switch to?
If your app only supports iOS 5.0 and above, use the official Apple-provided JSON library directly: nsjsonserialization
Library.
If your app to support iOS 5.0 below the system, then I personally recommend Jsonkit, but Jsonkit itself do a lot of memory optimization, so does not support arc, you can use it with the-fno-objc-arc of the compilation flag, The detailed steps for setting up this build flag can be found in this article.
The use of Jsonkit is also very convenient, in use only need to Sbjson Jsonvalue method replaced Objectfromjsondata,jsonrepresentation method for jsonstring can. Attach an example of use:
"JSONKit.h"
NSString *path = [[nsbundle Mainbundle] Pathforresource:@ "Data" OfType:@ "JSON"]; NSData *content = [nsdata Datawithcontentsoffile:path]; Nsdictionary *kitdata = [content objectfromjsondata]; NSString *kitstring = [Kitdata JSOnstring];
|
I hope you have a good time.
Original URL: Http://stackoverflow.com/questions/10681597/does-jsonkit-support-arc-or-is-there-a-fork-that-supports-arc
You can still use Jsonkit in your application with ARC.
I ' m using it myself.
Select your project root in XCode 5, under Targets
Select your application and then select the BuildPhases
tab. Under Compile Sources
Double-click JSONKIT.M and add the following compiler flags -fno-objc-arc
.
Hope it helps
Cheers
"Go" Do not use Sbjson (json-framework)