Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (21 sloc) 1.12 KB

Simple JSON-RPC Client based on top of AFNetworking (https://github.com/AFNetworking/AFNetworking)

http://json-rpc.org/

Example Usage

AFJSONRPCClient *client = [[AFJSONRPCClient alloc] initWithURL:[NSURL URLWithString:@"http://path.to/json-rpc/service/"]];

[client invokeWithMethod:@"method.name" success:^(AFHTTPRequestOperation *operation, id responseObject) {
    //success handling
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    //error handling
}];

[client invokeWithMethod:@"method.name" parameters:[NSArray arrayWithObjects:@"1", @"2", nil] success:^(AFHTTPRequestOperation *operation, id responseObject) {
    //success handling
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    //error handling
}];

[client invokeWithMethod:@"method.name" parameters:[NSArray arrayWithObject:@"1"] withRequestId:@"2" success:^(AFHTTPRequestOperation *operation, id responseObject) {
    //success handling
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    //error handling
}];