Checking for NSJSONSerialization using NS_CLASS_AVAILABLE macro instead of NSClassFromString
This commit is contained in:
parent
9a2b90c698
commit
a5a31f4609
1 changed files with 1 additions and 2 deletions
|
|
@ -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];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue