Merge branch 'request-decoding-error' of https://github.com/modcloth/AFNetworking into modcloth-request-decoding-error
This commit is contained in:
commit
f8d090f159
1 changed files with 9 additions and 1 deletions
|
|
@ -76,7 +76,15 @@ static dispatch_queue_t json_request_operation_processing_queue() {
|
||||||
// Workaround for a bug in NSJSONSerialization when Unicode character escape codes are used instead of the actual character
|
// Workaround for a bug in NSJSONSerialization when Unicode character escape codes are used instead of the actual character
|
||||||
// See http://stackoverflow.com/a/12843465/157142
|
// See http://stackoverflow.com/a/12843465/157142
|
||||||
NSData *JSONData = [self.responseString dataUsingEncoding:NSUTF8StringEncoding];
|
NSData *JSONData = [self.responseString dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
|
if (JSONData) {
|
||||||
self.responseJSON = [NSJSONSerialization JSONObjectWithData:JSONData options:self.JSONReadingOptions error:&error];
|
self.responseJSON = [NSJSONSerialization JSONObjectWithData:JSONData options:self.JSONReadingOptions error:&error];
|
||||||
|
} else {
|
||||||
|
//Could not decode response string
|
||||||
|
error = [[NSError alloc]initWithDomain:AFNetworkingErrorDomain
|
||||||
|
code:NSURLErrorCannotDecodeContentData
|
||||||
|
userInfo:@{NSLocalizedDescriptionKey : [NSString stringWithFormat:@"Could not decode:\n%@",self.responseString]}];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.JSONError = error;
|
self.JSONError = error;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue