码迷,mamicode.com
首页 > 其他好文 > 详细

DELETE 请求参数保存在Body 中

时间:2017-04-26 16:39:57      阅读:567      评论:0      收藏:0      [点我收藏+]

标签:nullable   ror   sync   tab   pre   span   int   tty   sda   

NSMutableDictionary *parameter = [NSMutableDictionary dictionary];
 
    NSString * url = [NSString stringWithFormat:signatureProxy,model2.scheduleId];
    NSMutableURLRequest * req = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
    req.HTTPMethod = @"DELETE";
    req.HTTPBody = [NSJSONSerialization dataWithJSONObject:parameter options:NSJSONWritingPrettyPrinted error:nil];//[parameter JSONData];//dic字典相当于parameters,请求体里的东西
    req.allHTTPHeaderFields = @{
                                @"Content-Type":@"application/json"
                                };//请求头里的东西
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    [NSURLConnection sendAsynchronousRequest:req queue:queue completionHandler:^(NSURLResponse * _Nullable response, NSData * _Nullable data, NSError * _Nullable connectionError) {
        if (connectionError) {
            //失败
            [ToolOfClass showMessage:@"操作失败"];
        } else {
            //成功
            dispatch_async(dispatch_get_main_queue(), ^{
                //回调或者说是通知主线程刷新,
                [_tableView reloadData];
                [ToolOfClass showMessage:@"操作成功"];
           });
        }
    }];

DELETE 请求参数保存在Body 中

标签:nullable   ror   sync   tab   pre   span   int   tty   sda   

原文地址:http://www.cnblogs.com/frounk/p/6769114.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!