My favorites | Sign in
Project Logo
                
Search
for
Updated May 16, 2009 by sbrautaset
Labels: Featured
InstallationInstructions  
Installation instructions

JSON Framework Installation

Here are a few ways to start using the JSON Framework in your application.

Option 1: Copy the JSON source files into your project

This is the simplest option and should always work—regardless of whether you're creating an application for the iPhone or a desktop Mac.

  1. Drag the JSON folder from the distribution and drop it on the 'Classes' group in the 'Groups & Files' menu of your Xcode project.
  2. Tick the 'Copy items into destination group's folder' option.
  3. Use #import "JSON.h" in your source files.

If you're upgrading from a previous version, make sure you're deleting the old JSON group first, moving all the files to Trash.

Option 2: Use the iPhone Custom SDK

  1. Create a directory ~/Library/SDKs, if it does not already exist.
  2. Copy the SDKs/JSON folder from this disk image into ~/Library/SDKs.
  3. In your Project, select your target in the left-hand menu and click the blue Info button (Apple-i) and select the "Build" tab.
  4. Make sure "All Configurations" is selected in the "Configuration" drop-down.
  5. Add the following new line to the "Additional SDKs" option: $HOME/Library/SDKs/JSON/${PLATFORM_NAME}.sdk
  6. Add the following two options to the "Other Linker Flags" option: 
-ObjC -ljson
  7. Use #import <JSON/JSON.h> in your source files.

Creating custom SDKs is not very well documented from Apple, so if this option fails for you, please go with Option 1 and just copy the source into your application.

Option 3: Use the Embedded Framework

This option will not work for iPhone applications! It only works for standard desktop Mac applications.

  1. If it doesn't already exist, create a directory called ~/Library/Frameworks.
  2. Copy the JSON.framework directory to ~/Library/Frameworks.
  3. Use the "Add existing file" menu to add ~/Library/Frameworks/JSON.framework to your application.
  4. Add a "Copy files" build phase to copy the framework into your application. This should copy files to the Frameworks folder inside Resources.
  5. Use #import <JSON/JSON.h> in your source files.

Apple's documentation on embedding private frameworks is a good resource and explains in more detail how to do this.

If you use this option you may notice a bit faster clean-and-build cycles because you don't have to rebuild the JSON sources.


Comment by jens.kohl, Jul 30, 2009

If you get errors like »error: syntax error before 'AT_NAME' token«, »error: syntax error before '}' token« and »fatal error: method definition not in @implementation context« (described in Issue #33) with option 2 maybe it helps to change the compiler to something other than 4.2 and back again to 4.2.


Sign in to add a comment
Hosted by Google Code