xcode iPhone 的 JSON 库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4993118/
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
JSON library for iPhone
提问by ofirbt
I want to use JSON library in my iPhone project. I've found that the json-framework library is the most popular at the moment. It can be found here: http://code.google.com/p/json-framework/.
我想在我的 iPhone 项目中使用 JSON 库。我发现 json-framework 库是目前最流行的。可以在这里找到:http: //code.google.com/p/json-framework/。
any other suggestions?
还有其他建议吗?
回答by 0x8badf00d
The library used in this application is one written by Stig Brautaset and hosted at code.google.com. I’ve used this library in two applications that are in the App Store, Today’s Horoscope, freeand paid. This is an excellent library, you can’t go wrong.
此应用程序中使用的库是由 Stig Brautaset 编写并托管在 code.google.com 上的库。我在 App Store 中的两个应用程序中使用了这个库,今天的星座,免费和付费。这是一个很棒的图书馆,你不会错的。
- Download the iPhone JSON framework
- 下载 iPhone JSON 框架
There are a few variations on the install process, the easiest and least prone to errors is to copy the source files directly into your project. In the project that is attached to this post, this is done for you, however, it’s shown here if you need to add the framework to an existing or future project.
安装过程有一些变化,最简单和最不容易出错的是将源文件直接复制到您的项目中。在本文附带的项目中,这是为您完成的,但是,如果您需要将框架添加到现有或未来的项目中,则会在此处显示。
- Open the dmg file from the download.
- Drag the JSON folder and drop it on the ‘Classes’ group in the ‘Groups & Files’ in your Xcode project.
- Check the “Copy items into destination group’s folder” option.
- You can now use #import “JSON.h”in your source files.
Xcode 项目下载 – 第 1 部分
- 从下载中打开 dmg 文件。
- 将 JSON 文件夹拖放到 Xcode 项目中“组和文件”中的“类”组中。
- 选中“将项目复制到目标组的文件夹”选项。
- 您现在可以在源文件中使用#import “JSON.h”。
To keep this post to a manageable length, I’ll show only the code that is most pertinent to JSON, Flickr and the overall application flow, the code on the periphery you’ll be familiar with and you can browse through at any time in the project source code.
为了保持这篇文章的长度可控,我将只展示与 JSON、Flickr 和整个应用程序流程最相关的代码,以及你熟悉的外围代码,你可以随时浏览项目源代码。
- Download iPhone, JSON and Flickr – Part 1Xcode project
- 下载iPhone、JSON 和 Flickr——第 1 部分Xcode 项目
Source: http://iosdevelopertips.com/networking/iphone-json-flickr-tutorial-part-1.html
来源:http: //iosdevelopertips.com/networking/iphone-json-flickr-tutorial-part-1.html
Updated Answer
更新答案
Use NSJSONSerialization Class https://developer.apple.com/documentation/foundation/jsonserialization
使用 NSJSONSerialization 类https://developer.apple.com/documentation/foundation/jsonserialization
回答by Jim
Here's the documentation on installing json-framework.
I like JSONKitmyself, it's simple and fast.
我自己喜欢JSONKit,它既简单又快速。