小编jma*_*mac的帖子

使用application/x-www-form-urlencoded的POST请求

后端开发人员在POST请求中给出了这些指令:

  1. 路线:{url}/{app_name/{controller}/{action}
  2. 控制器和动作应该是小型的.
  3. API测试链接:http:****************
  4. 请求应使用POST方法.
  5. 参数应通过请求内容主体(FormUrlEncodedContent)传递.
  6. 参数应为json格式.
  7. 参数是关键敏感的.

在协议中没有第5号经验,我搜索并以我的代码结束.

-(id)initWithURLString:(NSString *)URLString withHTTPMEthod:(NSString *)method withHTTPBody:(NSDictionary *)body {

    _URLString = URLString;
    HTTPMethod = method;
    HTTPBody = body;

    //set error message
    errorMessage = @"Can't connect to server at this moment. Try again later";
    errorTitle = @"Connection Error";

    return  self;
}


-(void)fireConnectionRequest {

    NSOperationQueue *mainQueue = [[NSOperationQueue alloc] init];
    [mainQueue setMaxConcurrentOperationCount:5];

    NSError *error = Nil;

    NSURL *url = [NSURL URLWithString:_URLString];
    NSMutableURLRequest *request = [[NSMutableURLRequest …
Run Code Online (Sandbox Code Playgroud)

iphone json httprequest ios

30
推荐指数
5
解决办法
4万
查看次数

标签 统计

httprequest ×1

ios ×1

iphone ×1

json ×1