郝萌主倾心贡献,尊重作者的劳动成果,请勿转载。

假设文章对您有所帮助。欢迎给作者捐赠。支持郝萌主,捐赠数额任意,重在心意^_^

我要捐赠: 点击捐赠

Cocos2d-X源代码下载:点我传送

This is a guide to help developers get up to speed with AFNetworking. It is geared primarily towards anyone who is new to Mac or iOS development, or has not worked extensively with 3rd-party libraries
before.

These step-by-step instructions are written for Xcode 5, using the iOS 7 SDK. If you are using a previous version of Xcode, you may want to update before starting.

Step 1: Download CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like AFNetworking
in your projects.

CocoaPods is distributed as a ruby gem, and is installed by running the following commands in Terminal.app:

$ sudo gem install cocoapods
$ pod setup

Depending on your Ruby installation, you may not have to run assudo to install the cocoapods gem.

Step 2: Create a Podfile

Project dependencies to be managed by CocoaPods are specified in a file calledPodfile. Create this file in the same directory as your Xcode project (.xcodeproj) file:

$ touch Podfile
$ open -a Xcode Podfile

You just created the pod file and opened it using Xcode! Ready to add some content to the empty pod file?

Copy and paste the following lines into the TextEdit window:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
pod 'AFNetworking', '~> 2.5'

You shouldn’t use TextEdit to edit the pod file because TextEdit likes to replace standard quotes with more graphically appealing quotes. This can cause CocoaPods to get confused and display errors,
so it’s best to just use Xcode or another programming text editor.

Step 3: Install Dependencies

Now you can install the dependencies in your project:

$ pod install

From now on, be sure to always open the generated Xcode workspace (.xcworkspace) instead of the project file when building your project:

$ open <YourProjectName>.xcworkspace

Step 4: Dive In!

At this point, everything's in place for you to start using AFNetworking. Just#import the headers for the classes you need and get to it!

郝萌主倾心贡献,尊重作者的劳动成果,请勿转载。

假设文章对您有所帮助。欢迎给作者捐赠,支持郝萌主,捐赠数额任意。重在心意^_^

我要捐赠: 点击捐赠

Cocos2d-X源代码下载:点我传送

版权声明:本文博客原创文章,博客,未经同意,不得转载。

开始AFNetworking的更多相关文章

  1. 【原】AFNetworking源码阅读(六)

    [原]AFNetworking源码阅读(六) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 这一篇的想讲的,一个就是分析一下AFSecurityPolicy文件,看看AF ...

  2. 【原】AFNetworking源码阅读(五)

    [原]AFNetworking源码阅读(五) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 上一篇中提及到了Multipart Request的构建方法- [AFHTTP ...

  3. 【原】AFNetworking源码阅读(四)

    [原]AFNetworking源码阅读(四) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 上一篇还遗留了很多问题,包括AFURLSessionManagerTaskDe ...

  4. 【原】AFNetworking源码阅读(三)

    [原]AFNetworking源码阅读(三) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 上一篇的话,主要是讲了如何通过构建一个request来生成一个data tas ...

  5. 【原】AFNetworking源码阅读(二)

    [原]AFNetworking源码阅读(二) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 上一篇中我们在iOS Example代码中提到了AFHTTPSessionMa ...

  6. 【原】AFNetworking源码阅读(一)

    [原]AFNetworking源码阅读(一) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 AFNetworking版本:3.0.4 由于我平常并没有经常使用AFNetw ...

  7. AFNetworking 3.0 源码解读 总结(干货)(下)

    承接上一篇AFNetworking 3.0 源码解读 总结(干货)(上) 21.网络服务类型NSURLRequestNetworkServiceType 示例代码: typedef NS_ENUM(N ...

  8. AFNetworking 3.0 源码解读 总结(干货)(上)

    养成记笔记的习惯,对于一个软件工程师来说,我觉得很重要.记得在知乎上看到过一个问题,说是人类最大的缺点是什么?我个人觉得记忆算是一个缺点.它就像时间一样,会自己消散. 前言 终于写完了 AFNetwo ...

  9. AFNetworking 3.0 源码解读(十一)之 UIButton/UIProgressView/UIWebView + AFNetworking

    AFNetworking的源码解读马上就结束了,这一篇应该算是倒数第二篇,下一篇会是对AFNetworking中的技术点进行总结. 前言 上一篇我们总结了 UIActivityIndicatorVie ...

  10. AFNetworking 3.0 源码解读(十)之 UIActivityIndicatorView/UIRefreshControl/UIImageView + AFNetworking

    我们应该看到过很多类似这样的例子:某个控件拥有加载网络图片的能力.但这究竟是怎么做到的呢?看完这篇文章就明白了. 前言 这篇我们会介绍 AFNetworking 中的3个UIKit中的分类.UIAct ...

随机推荐

  1. 有什么很好的软件是用 Qt 编写的?

    作者:尘中远链接:http://www.zhihu.com/question/19630324/answer/19365369来源:知乎 一些出名的例子如下:(wiki搬运) 3DSlicer, a ...

  2. Eclipse3.6 添加JUnit源代码

    Eclipse中无法查看JUnit源代码,也无法设置源代码的jar. 解决方法: 1.  下载org.junit.source_4.8.1.v4_8_1_v20100427-1100.jar,放到ec ...

  3. ios创建画笔的样例(双笔画效果)

    定义一个UIView:主要是在这个View里面加一个UIImageView,绘图都在这个UIImageView里面进行 @property(nonatomic) CGPoint prePoint; / ...

  4. ACM比赛(第二次A)

    ime Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Description There is ...

  5. [转]Permission denied: /.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

    原文链接:http://blog.csdn.net/dyw/article/details/6612497 近日,在Apache2环境下部署Rails3应用时碰到此错误: Permission den ...

  6. 演练5-8:Contoso大学校园管理系统(实现存储池和工作单元模式)

    在上一次的教程中,你已经使用继承来消除在 Student 和 Instructor 实体之间的重复代码.在这个教程中,你将要看到使用存储池和工作单元模式进行增.删.改.查的一些方法.像前面的教程一样, ...

  7. 统一横轴墨卡托投影(UTM)

    UTM 坐标系统使用基于网格的方法表示坐标.UTM 系统将地球分为 60 个区,每一个区基于横轴墨卡托投影.画图法中的地图投影方法能够在平面中表示一个两维的曲面,比如一个标准地图.图 1 展示了一个横 ...

  8. 【剑指offer】字符串转整数

    转载请注明出处:http://blog.csdn.net/ns_code/article/details/28015693 题目描写叙述: 将一个字符串转换成一个整数,要求不能使用字符串转换整数的库函 ...

  9. forEach嵌套循环的问题

    程序中: List firstList = ; i<firstList.size(); i++) { List secondListList = request.setAttribute(&qu ...

  10. android绑定Service失败原因

    今天抄一个代码,学习Service,中间Service的绑定一直是失败的. bindService返回false 上网查询的话都是一些,比如说TabHost的问题 发现和自己的问题不一样. 最后想了想 ...