• 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

     

  • 相关阅读:
    Apollo 配置中心
    Sentinel 限流
    soul 网关
    xxl-job 任务管理
    java Young GC排查
    bitmap(位图)
    RabbitMQ一个简单可靠的方案(.Net Core实现)
    从技术角度讨论微服务
    你可能不知道的.Net Core Configuration
    浅谈开发模式及架构发展
  • 原文地址:https://www.cnblogs.com/liuwj/p/6920148.html
Copyright © 2020-2023  润新知