Checking for NSJSONSerialization using NS_CLASS_AVAILABLE macro instead of NSClassFromString

This commit is contained in:
Mattt Thompson 2011-08-03 13:11:01 -05:00
parent 9a2b90c698
commit a5a31f4609

View file

@ -62,8 +62,7 @@
} else { } else {
id JSON = nil; id JSON = nil;
Class NSJSONSerialization = NSClassFromString(@"NSJSONSerialization"); if ([NSJSONSerialization class]) {
if (NSJSONSerialization) {
JSON = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; JSON = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
} else { } else {
JSON = [[JSONDecoder decoder] objectWithData:data error:&error]; JSON = [[JSONDecoder decoder] objectWithData:data error:&error];