HTTP Library afnetworking under iOS

Source: Internet
Author: User

Developed under iOS has been using the asihttprequest Library,ASIHTTPRequest has stopped updating and read this article http://www.oschina.net/news/ 61416/github-top-100-objective-c-projects (Original https://github.com/Aufree/trip-to-iOS/blob/master/ TOP-100.MD) Afnetworking Library, feel good.


the address of the Afnetworking library is

Https://github.com/AFNetworking/AFNetworking

As you can see on the homepage, the use of the Afnetworking library is simple

GET request

Afhttprequestoperationmanager *manager = [Afhttprequestoperationmanager manager]; [Manager get:@ "Http://example.com/resources.json" Parameters:nil success:^ (afhttprequestoperation *operation, ID        Responseobject) {NSLog (@ "JSON:%@", Responseobject);} failure:^ (Afhttprequestoperation *operation, Nserror *error) { NSLog (@ "error:%@", error);}];

POST request

Afhttprequestoperationmanager *manager = [Afhttprequestoperationmanager manager]; Nsdictionary *parameters = @{@ "foo": @ "bar"}; [Manager post:@ "Http://example.com/resources.json" Parameters:parameters success:^ (Afhttprequestoperation * operation, id responseobject) {NSLog (@ "JSON:%@", Responseobject);} failure:^ (Afhttprequestoperation *operation, NSERR or *error) {NSLog (@ "error:%@", error);}];

There are plenty of ways to go directly to the GitHub homepage to see https://github.com/AFNetworking/AFNetworking

HTTP Library afnetworking under iOS

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.