Conditionally define the _af_nsjson_* labels.
These are only used when _AFNETWORKING_PREFER_NSJSONSERIALIZATION_ is defined. Otherwise, they generate unused symbol warnings under strict compilation settings.
This commit is contained in:
parent
8da16a056c
commit
8559968514
1 changed files with 28 additions and 26 deletions
|
|
@ -75,7 +75,9 @@ static NSData * AFJSONEncode(id object, NSError **error) {
|
||||||
*error = [[[NSError alloc] initWithDomain:NSStringFromClass([exception class]) code:0 userInfo:[exception userInfo]] autorelease];
|
*error = [[[NSError alloc] initWithDomain:NSStringFromClass([exception class]) code:0 userInfo:[exception userInfo]] autorelease];
|
||||||
}
|
}
|
||||||
} else if (_NSJSONSerializationClass && [_NSJSONSerializationClass respondsToSelector:_NSJSONSerializationSelector]) {
|
} else if (_NSJSONSerializationClass && [_NSJSONSerializationClass respondsToSelector:_NSJSONSerializationSelector]) {
|
||||||
_af_nsjson_encode: {
|
#ifdef _AFNETWORKING_PREFER_NSJSONSERIALIZATION_
|
||||||
|
_af_nsjson_encode:
|
||||||
|
#endif
|
||||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[_NSJSONSerializationClass methodSignatureForSelector:_NSJSONSerializationSelector]];
|
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[_NSJSONSerializationClass methodSignatureForSelector:_NSJSONSerializationSelector]];
|
||||||
invocation.target = _NSJSONSerializationClass;
|
invocation.target = _NSJSONSerializationClass;
|
||||||
invocation.selector = _NSJSONSerializationSelector;
|
invocation.selector = _NSJSONSerializationSelector;
|
||||||
|
|
@ -87,7 +89,6 @@ static NSData * AFJSONEncode(id object, NSError **error) {
|
||||||
|
|
||||||
[invocation invoke];
|
[invocation invoke];
|
||||||
[invocation getReturnValue:&data];
|
[invocation getReturnValue:&data];
|
||||||
}
|
|
||||||
} else {
|
} 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];
|
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] raise];
|
[[NSException exceptionWithName:NSInternalInconsistencyException reason:NSLocalizedString(@"No JSON generation functionality available", nil) userInfo:userInfo] raise];
|
||||||
|
|
@ -145,7 +146,9 @@ static id AFJSONDecode(NSData *data, NSError **error) {
|
||||||
[invocation invoke];
|
[invocation invoke];
|
||||||
[invocation getReturnValue:&JSON];
|
[invocation getReturnValue:&JSON];
|
||||||
} else if (_NSJSONSerializationClass && [_NSJSONSerializationClass respondsToSelector:_NSJSONSerializationSelector]) {
|
} else if (_NSJSONSerializationClass && [_NSJSONSerializationClass respondsToSelector:_NSJSONSerializationSelector]) {
|
||||||
_af_nsjson_decode: {
|
#ifdef _AFNETWORKING_PREFER_NSJSONSERIALIZATION_
|
||||||
|
_af_nsjson_decode:
|
||||||
|
#endif
|
||||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[_NSJSONSerializationClass methodSignatureForSelector:_NSJSONSerializationSelector]];
|
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[_NSJSONSerializationClass methodSignatureForSelector:_NSJSONSerializationSelector]];
|
||||||
invocation.target = _NSJSONSerializationClass;
|
invocation.target = _NSJSONSerializationClass;
|
||||||
invocation.selector = _NSJSONSerializationSelector;
|
invocation.selector = _NSJSONSerializationSelector;
|
||||||
|
|
@ -157,7 +160,6 @@ static id AFJSONDecode(NSData *data, NSError **error) {
|
||||||
|
|
||||||
[invocation invoke];
|
[invocation invoke];
|
||||||
[invocation getReturnValue:&JSON];
|
[invocation getReturnValue:&JSON];
|
||||||
}
|
|
||||||
} else {
|
} 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];
|
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] raise];
|
[[NSException exceptionWithName:NSInternalInconsistencyException reason:NSLocalizedString(@"No JSON parsing functionality available", nil) userInfo:userInfo] raise];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue