Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errors on JSONKit implement

The Errors

Upon importing the JSONKit.h and JSONKit.m files into my project , i get the following errors. I have browsed and browsed but none seems to have encountered these problems ?

All i did was import the files and build and then i get this

Is it something i forgot to import or ...??????

like image 316
SnK Avatar asked Apr 04 '12 12:04

SnK


2 Answers

You can disable ARC(automatic reference count) in JSONKit files.

Generally step is :

  1. Go to your project settings, under Build Phases > Compile Sources
  2. Select the files you want ARC disabled and add -fno-objc-arc compiler flags. You can set flags for multiple files in one shot by selecting the files then hitting "Enter" key.

Please refer to this post: iOS 5 Best Practice (Release/retain?) for more details.

Hope it helps.

Edit

After discussion, we also have some other options to solve the problem. For example, you can convert JSONKit to ARC compatible. But according to Mike Weller's statement, it will be very hard to convert because JSONKit uses malloc to manage memory.

I think use -fno-objc-arc compiler flag is a low-risk and convenient way to solve the problem.

like image 173
tangqiaoboy Avatar answered Oct 26 '22 05:10

tangqiaoboy


tangqiaoboy's answer will resolve those errors but you can also consider using the class NSJSONSerialization. It makes it really easy do convert NSDictionarys and NSArrays to JSON and vice-versa.

Good luck!

like image 30
Zalykr Avatar answered Oct 26 '22 07:10

Zalykr