TacoShell 0.0.7

TacoShell 0.0.7

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2014年12月

Marcus Kida维护。



TacoShell 0.0.7

使用

要运行示例项目,首先克隆仓库,然后从示例目录运行pod install。更多文档,请访问CocoaDocs页面

使用TacoShell执行一个GET请求非常简单,就像这样

TacoShell *ts = [[TacoShell alloc] initWithURL:[NSURL URLWithString:@"http://guacamole.burritokit.com/"]];
ts.completionBlock = ^(NSDictionary *dictionary, NSInteger httpResponseStatusCode, id response){
    NSLog(@"Your IP Address is: %@", response[@"meta"][@"ip"]);
};
[ts start];

就这样!TacoShell会自动反序列化包含application/json的相应Content-Type的内容。

要使用multipart/form-data执行POST请求,只需将所需字段传递给POSTDictionary

...
ts.method = BKTSRequestMethodPOST;
ts.POSTDictionary = @{"username": "karl"};
...

如果没有指定Content-Type,并且设置了POSTDictionary,则Content-Type将默认为multipart/form-data

如果您要将POSTDictionaryJSON的形式放在Body中,则请像这样设置Content-TypeBKTSRequestContentTypeApplicationJSON

...
ts.contentType = BKTSRequestContentTypeApplicationJSON;
...

很简单,不是吗?

需求

  • CocoaPods

安装

作者

Marcus Kida,[email protected]

许可证

TacoShell可在MIT许可证下使用。有关更多信息,请参阅LICENSE文件。