diff --git a/AFNetworking/AFJSONUtilities.h b/AFNetworking/AFJSONUtilities.h index 95dc938..5064e37 100644 --- a/AFNetworking/AFJSONUtilities.h +++ b/AFNetworking/AFJSONUtilities.h @@ -82,6 +82,9 @@ static NSData * AFJSONEncode(id object, NSError **error) { [invocation invoke]; [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; @@ -138,6 +141,9 @@ static id AFJSONDecode(NSData *data, NSError **error) { [invocation invoke]; [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;