测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布上次发布 | 2019年10月 |
由 Matteo Pacini 维护。
依赖项 | |
AFNetworking | ~> 2.3.0 |
ReactiveCocoa | ~> 2.3.1 |
libextobjc | ~> 0.4 |
RXDataRetriever 是一个响应式 JSON RESTful 客户端。
它依赖于 ReactiveCocoa 和 AFNetworking
将以下内容添加到您的 Podfile 中
pod 'RXDataRetriever', '~> 0.1'
在您的前缀中导入此类
#import <RXDataRetriever/RXDataRetriever.h>
GET 支持查询参数。如果不需要,只需传递 nil。
[[RXDataRetriever instance] GET:@"/doge" query:@{"such":"networking","much","reactive"}]
...生成此 URL
@"/doge?such=networking&much=reactive"
如果需要,查询值将被 URL 编码。
首先配置客户端。
[RXDataRetriever instance].baseURL = @"https://api.github.com"
[RXDataRetriever instance].errorResponseDomain = @"api.github.com"
[RXDataRetriever instance].errorResponseKeyPath = @"message"
检索用户名
[[[[RXDataRetriever instance] GET:@"/users/Zi0P4tch0" query:nil]
map:^id(id value) {
return value[@"name"];
}] subscribeNext:^(NSString* name) {
NSLog(@"Name is: \"%@\"", name);
}];
Swift 将不会得到支持,直到 ReactiveCocoa 和 AFNetworking 100% 在它上面工作。
分叉仓库并发送拉取请求!
Copyright (c) 2014 Matteo Pacini
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.