AFNetWorking 简单使用方法

                        //网络POSt请求
                        AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
                        // 设置接受数据格式
                        [manager.responseSerializer setAcceptableContentTypes: [NSSet setWithObjects:@"application/json", @"text/json",@"text/javascript",@"text/html",@"text/css", nil]];
                        // 设置请求格式
                        manager.requestSerializer = [AFJSONRequestSerializer serializer];
                        // 设置返回格式
                        // manager.responseSerializer = [AFJSONResponseSerializer serializer];
                        //POST网络请求

         [manager POST:apiName parameters:bodyDic success:^(AFHTTPRequestOperation *operation, id responseObject) {

            //  success   your code

                }failure:^(AFHTTPRequestOperation *operation, NSError *error){

            //      failure    your code

             }

 

posted @ 2015-10-28 16:11  偷窃者  阅读(351)  评论(0编辑  收藏  举报