an intermediate object returned by the JSONRPCService when you call a method, to help you define how to handle the response. More...
#import <JSONRPCResponseHandler.h>
Public Member Functions | |
(void) | - setDelegate:callback: |
set both the delegate and the callback to call upon receiving the WebService's response | |
(void) | - setDelegate:callback:resultClass: |
set both the delegate, the callback and the resultClass at once. | |
(void) | - retryRequest |
Relaunch the request associated with this responseHandler. You should not need to call this method yourself as this is done automatically upon network error. | |
Properties | |
JSONRPCMethodCall * | methodCall |
the method call attached with this response handler | |
id< NSObject > | delegate |
The delegate object on which the callback will be called. | |
SEL | callback |
The callback (@selector) to call when receiving the response from the WebService. | |
Class | resultClass |
int | maxRetryAttempts |
NSTimeInterval | delayBeforeRetry |
an intermediate object returned by the JSONRPCService when you call a method, to help you define how to handle the response.
JSONRPCResponseHandler is an intermediate object used to define a delegate and a callback (= a target and an action) to call when the WebService's response is received, and the Objective-C class to use if you want the received JSON object to be converted to a custom Obj-C object automatically before calling the callback.
You typically don't create a JSONRPCResponseHandler yourself. Instead, you retreive such objects when calling callMethod: (JSONRPCService) or similar methods; this returned object help you define how to handle the response returned by the WebService after the method call.
- (void) setDelegate: | (id<NSObject>) | aDelegate | ||
callback: | (SEL) | callback | ||
set both the delegate and the callback to call upon receiving the WebService's response
aDelegate | the delegate object that will receive the message (on which the callback will be called) | |
callback | the @selector to call (the message to send onto the delegate) |
- (void) setDelegate: | (id<NSObject>) | aDelegate | ||
callback: | (SEL) | callback | ||
resultClass: | (Class) | cls | ||
set both the delegate, the callback and the resultClass at once.
aDelegate | the delegate object that will receive the message (on which the callback will be called) | |
callback | the @selector to call (the message to send onto the delegate) | |
cls | the Class to convert the received JSON object to before calling the callback. |
[[service callMethod:xxx] setDelegate:d callback:@selector(methodCall:didReturn:error:) resultClass:[MyCustomObject class]]
- (SEL) callback [read, write, assign] |
The callback (@selector) to call when receiving the response from the WebService.
This @selector must take three parameters:
- (id<NSObject>) delegate [read, write, retain] |
The delegate object on which the callback will be called.
- (Class) resultClass [read, write, assign] |
The class to convert the received object to, if wanted. If this @property is not nil, the received JSON object will be converted to an instance of the given class before calling the callback @selector. The provided class must conform to the JSONInitializer informal protocol, i.e. it must respond to -initWithJson: .