YYHJSONRequest Class Reference
| Inherits from | YYHRequest : NSObject |
| Declared in | YYHJSONRequest.h YYHJSONRequest.m |
Overview
Simple and lightweight class for loading asynchronous HTTP requests w/ JSON. Built on NSURLConnection and NSOperationQueue. Uses NSJSONSerialization for reading and writing JSON.
Usage
[YYHJSONRequest loadJSONWithURL:[NSURL URLWithString:@"http://foo.bar/json"] success:^(id json) {
// json response
} failure:^(NSError *error) {
// failure
}];
Tasks
Configuring a Request
-
readingOptionsproperty -
writingOptionsproperty -
– onJSONSuccess:
Loading a JSON Request
Other Methods
Properties
Class Methods
loadJSONWithURL:success:failure:
Create and load a JSON request.
+ (instancetype)loadJSONWithURL:(NSURL *)url success:(void ( ^ ) ( id json ))success failure:(void ( ^ ) ( NSError *error ))failureParameters
- url
NSURL used to load the request.
- success
Called when request has loaded successfully.
- failure
Called when request fails to load.
Discussion
Create and load a JSON request.
Declared In
YYHJSONRequest.hInstance Methods
initWithURL:
Initialize request.
- (instancetype)initWithURL:(NSURL *)urlParameters
- url
NSURL used to load the request.
- success
Called when request has loaded successfully.
- failure
Called when request fails to load.
Discussion
Initialize request.
Declared In
YYHRequest.hloadJSONWithSuccess:failure:
Load a JSON request.
- (void)loadJSONWithSuccess:(void ( ^ ) ( id json ))success failure:(void ( ^ ) ( NSError *error ))failureParameters
- success
Called when request has loaded successfully.
- failure
Called when request fails to load.
- url
NSURL used to load the request.
Discussion
Load a JSON request.
Declared In
YYHJSONRequest.h