1

The instructions for installing the JSON Framework seem to be for older versions of Xcode. I'm relatively unfamiliar with Xcode and I can't figure out how to properly import the framework into my project. I selected all of the files in the "Classes" folder (JSON.h, NSObject+JSON.h, etc.) that comes in the download, dragged them into the main area of my project, and added #import <JSON/JSON.h> to my ViewController's .h and .m files, and I get a No such file or directory error for JSON/JSON.h

What am I doing incorrectly here?

Dejell
  • 13,947
  • 40
  • 146
  • 229
Tom
  • 371
  • 5
  • 4
  • possible duplicate of [How to "add existing frameworks" in XCode 4?](http://stackoverflow.com/questions/3352664/how-to-add-existing-frameworks-in-xcode-4) – zneak Apr 12 '11 at 00:24
  • No, the download is not a file named "JSON.framework" or something. I tried that method earlier anyway but it didn't work either. – Tom Apr 12 '11 at 00:27

2 Answers2

3

If you’ve placed the files under the Classes group and haven’t taken any further action, they’re at the root of your project directory. As such, import it as

#import "JSON.h"
  • The build will fail at link time. – zneak Apr 12 '11 at 00:32
  • To add to this answer, you are indicating with that the headers should be loaded from a framework directory. "JSON.h" is what you want when dragging the files into your project. – Ben Scheirman Apr 12 '11 at 00:32
  • Ah, that was it. Thanks. How would I import the files if I wanted to use my original import code? Not that it matters for this project, just curious. – Tom Apr 12 '11 at 00:33
  • zneak: not if the classes are added to the target properly. – Ben Scheirman Apr 12 '11 at 00:33
  • That's what you do if you have a Framework on your machine for JSON. I did this for a little while, but since the libraries are static, they have to support the SDKs you're using. The JSON framework wasn't updated for 4.0 right away, so it was easier to just copy the files over. – Ben Scheirman Apr 12 '11 at 00:34
  • @Tom, you'd make another folder in your classes folder 'JSON' and put them there – Robot Woods Apr 12 '11 at 00:34
  • @zneak Although the project is called JSON framework, many developers simply copy the source files to the project. It’s more like a conceptual framework rather than a framework in the linker sense. –  Apr 12 '11 at 00:36
1

I think you're indicating that you're importing JSON.h from the JSON folder, and it sounds from your description you don't have those in a folder...

Robot Woods
  • 5,677
  • 2
  • 21
  • 30
  • I'm importing every .h and .m file included in the JSON framework download, as the installation instructions say. The files are laid out the same way as they are in the example project included in the framework download, which works fine. – Tom Apr 12 '11 at 00:28