在 Xcode 4 中导入 Objective-C JSON 框架
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5629019/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Importing Objective-C JSON Framework in Xcode 4
提问by Tom
The instructions for installing the JSON Frameworkseem 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
安装JSON 框架的说明似乎适用于旧版本的 Xcode。我对 Xcode 比较陌生,不知道如何将框架正确导入到我的项目中。我选择了下载中的“Classes”文件夹(JSON.h、NSObject+JSON.h 等)中的所有文件,将它们拖到我项目的主要区域,并添加#import <JSON/JSON.h>
到我的 ViewController 的 .h 和.m 文件,并且我收到 JSON/JSON.h 的 No such file or directory 错误
What am I doing incorrectly here?
我在这里做错了什么?
回答by
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
如果您已将文件放在 Classes 组下并且没有采取任何进一步的操作,则它们位于项目目录的根目录下。因此,将其导入为
#import "JSON.h"
回答by Robot Woods
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...
我认为您是在表明您正在从 JSON 文件夹中导入 JSON.h,从您的描述中可以看出,您在文件夹中没有这些...