Updates AFJSONRequestOperation to allow JSON parsing options since it is now using the NSJSONSerialization class by default
This commit is contained in:
parent
4b2c2818a1
commit
5d37e534f7
2 changed files with 7 additions and 2 deletions
|
|
@ -33,7 +33,7 @@
|
||||||
- `application/json`
|
- `application/json`
|
||||||
- `text/json`
|
- `text/json`
|
||||||
|
|
||||||
@warning JSON parsing will automatically use JSONKit, SBJSON, YAJL, or NextiveJSON, if provided. Otherwise, the built-in `NSJSONSerialization` class is used, if available (iOS 5.0 and Mac OS 10.7). If the build target does not either support `NSJSONSerialization` or include a third-party JSON library, a runtime exception will be thrown when attempting to parse a JSON request.
|
@warning JSON parsing will use the built-in `NSJSONSerialization` class.
|
||||||
*/
|
*/
|
||||||
@interface AFJSONRequestOperation : AFHTTPRequestOperation
|
@interface AFJSONRequestOperation : AFHTTPRequestOperation
|
||||||
|
|
||||||
|
|
@ -46,6 +46,11 @@
|
||||||
*/
|
*/
|
||||||
@property (readonly, nonatomic, strong) id responseJSON;
|
@property (readonly, nonatomic, strong) id responseJSON;
|
||||||
|
|
||||||
|
/**
|
||||||
|
A bitmask of options that will be used by the NSJSONSerialization class that parses the JSON data from the response.
|
||||||
|
*/
|
||||||
|
@property (readwrite) NSJSONReadingOptions parseOptions;
|
||||||
|
|
||||||
///----------------------------------
|
///----------------------------------
|
||||||
/// @name Creating Request Operations
|
/// @name Creating Request Operations
|
||||||
///----------------------------------
|
///----------------------------------
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ static dispatch_queue_t json_request_operation_processing_queue() {
|
||||||
if ([self.responseData length] == 0) {
|
if ([self.responseData length] == 0) {
|
||||||
self.responseJSON = nil;
|
self.responseJSON = nil;
|
||||||
} else {
|
} else {
|
||||||
self.responseJSON = [NSJSONSerialization JSONObjectWithData:self.responseData options:0 error:&error];
|
self.responseJSON = [NSJSONSerialization JSONObjectWithData:self.responseData options:self.parseOptions error:&error];
|
||||||
}
|
}
|
||||||
|
|
||||||
self.JSONError = error;
|
self.JSONError = error;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue