Throw an exception if no JSON parsing or generation functionality is available in AFJSONEncode/AFJSONDecode
This commit is contained in:
parent
03bc87dfd7
commit
7d465da4a3
1 changed files with 6 additions and 0 deletions
|
|
@ -82,6 +82,9 @@ static NSData * AFJSONEncode(id object, NSError **error) {
|
||||||
|
|
||||||
[invocation invoke];
|
[invocation invoke];
|
||||||
[invocation getReturnValue:&data];
|
[invocation getReturnValue:&data];
|
||||||
|
} else {
|
||||||
|
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:NSLocalizedString(@"Please either target a platform that supports NSJSONSerialization or add one of the following libraries to your project: JSONKit, SBJSON, or YAJL", nil) forKey:NSLocalizedRecoverySuggestionErrorKey];
|
||||||
|
[NSException exceptionWithName:NSInternalInconsistencyException reason:NSLocalizedString(@"No JSON generation functionality available", nil) userInfo:userInfo];
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
@ -138,6 +141,9 @@ static id AFJSONDecode(NSData *data, NSError **error) {
|
||||||
|
|
||||||
[invocation invoke];
|
[invocation invoke];
|
||||||
[invocation getReturnValue:&JSON];
|
[invocation getReturnValue:&JSON];
|
||||||
|
} else {
|
||||||
|
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:NSLocalizedString(@"Please either target a platform that supports NSJSONSerialization or add one of the following libraries to your project: JSONKit, SBJSON, or YAJL", nil) forKey:NSLocalizedRecoverySuggestionErrorKey];
|
||||||
|
[NSException exceptionWithName:NSInternalInconsistencyException reason:NSLocalizedString(@"No JSON parsing functionality available", nil) userInfo:userInfo];
|
||||||
}
|
}
|
||||||
|
|
||||||
return JSON;
|
return JSON;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue