zoukankan      html  css  js  c++  java
  • IOS AFN (第三方请求)

     


    什么是AFN
    全称是AFNetworking,是对NSURLConnection、NSURLSession的一层封装
    虽然运行效率没有ASI高,但是使用比ASI简单
    在iOS开发中,使用比较广泛

    AFN的github地址
    https://github.com/AFNetworking/AFNetworking

     

    版本

    适用iOS版本

    Xcode要求

    2.0+

    iOS 6.0+

    Xcode 5.0+

    1.x

    iOS 5.0

     

    0.10.x

    iOS 4.3

     


    AFHTTPRequestOperationManager
    AFN中最重要的对象之一
    封装了HTTP请求的常见处理
    GETPOST请求
    解析服务器的响应数据

    创建
    AFHTTPRequestOperationManager *mgr = [AFHTTPRequestOperationManager manager];

     

     

    GET请求
    - (AFHTTPRequestOperation *)GET:(NSString *)URLString
                         parameters:(id)parameters
                            success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
                            failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
    
    POST请求
    - (AFHTTPRequestOperation *)POST:(NSString *)URLString
                          parameters:(id)parameters
                             success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
                             failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure

     

  • 相关阅读:
    2019.8.15刷题统计
    2019.8.12刷题统计
    2019.8.11刷题统计
    2019.8.10刷题统计
    2019.8.9刷题统计
    2019.8.8刷题统计
    2019.8.7刷题统计
    2019.8.6刷题统计
    xuezhan.org 6.28
    xuezhan.org 6.27
  • 原文地址:https://www.cnblogs.com/liuwj/p/6920148.html
Copyright © 2011-2022 走看看