ios json controller class
- with delegate
implement URLRequestDelegate in .h file
run query in .m file:
URLRequest *request = [[URLRequest alloc] initWithRequest:[URLRequest getData]];
[request startWithDelegate:self];
implement delegate functions:
@optional -(void)requestFinished:(id)request withData:(NSMutableDictionary *)data;
@optional -(void)requestFailed:(id)request withError:(NSError *)error;
@optional -(void)requestShouldStart:(id)request;
- with block
run query in .m file:
URLRequest *request = [[URLRequest alloc] initWithRequest:[URLRequest getVersion]];
[request startWithCompletion:^(URLRequest request, NSMutableDictionary result, NSError *error) {
//do something
}
- without callback
run query in .m file:
[request startWithNoCallback];
@property (nonatomic, readonly) NSData *rawData;
if you don't need json structure you can use rawData property to get the raw data from the response
@property (readonly) int httpStatusCode;
show the http status code, what the server gives