In iOS i want send a POST request to a json-RPC web service. How can i do this? i read This Page before and this repo but none of them have helped me.
Asked
Active
Viewed 568 times
2 Answers
2
Take a look at the popular AFNetworking networking library. This provides full networking functionality and very well documented code. Although you can also use Apple's networking APIs for this.
Simple AFNetworking example:
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
NSDictionary *params = @{@"q":@"Chicago",
@"units":@"imperial",
@"type":@"like",
@"mode":@"json"
};
[manager GET:@"http://api.openweathermap.org/data/2.5/weather" parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
//Success
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
//Failure
}];
Michael
- 6,561
- 5
- 38
- 55
0
There is this AFJSONRPCClient, which is a JSON-RPC Client built on AFNetworking.
Hope it helps.
ljk321
- 16,242
- 7
- 48
- 60