Start using AFNetworking and use AFNetworking

Source: Internet
Author: User
Tags install cocoapods

Start using AFNetworking and use AFNetworking

Master haomeng is devoted to his contribution and respects the author's Labor achievements. Do not repost them.

If the article is helpful to you, you are welcome to donate to the author, support haomeng master, the amount of donation is free, focusing on your mind ^_^

I want to donate: Click to donate

Cocos2d-X source code download: point I send


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 runsudoTo 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#importThe headers for the classes you need and get to it!

Master haomeng is devoted to his contribution and respects the author's Labor achievements. Do not repost them.

If the article is helpful to you, you are welcome to donate to the author, support haomeng master, the amount of donation is free, focusing on your mind ^_^

I want to donate: Click to donate

Cocos2d-X source code download: point I send


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.