Use NSJSONSerialization
This commit is contained in:
1 parent
cdccb83573
commit
4e61b461b5
1 file changed
+7
-4
+7
-4
@@ -8,8 +8,6 @@
|
|||||||
|
|
||||||
#import "MP42Ratings.h"
|
#import "MP42Ratings.h"
|
||||||
|
|
||||||
#import "JSONKit.h"
|
|
||||||
|
|
||||||
@implementation MP42Ratings
|
@implementation MP42Ratings
|
||||||
|
|
||||||
@synthesize ratings;
|
@synthesize ratings;
|
||||||
@@ -30,8 +28,13 @@
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONDecoder *jsonDecoder = [JSONDecoder decoder];
|
NSData *data = [NSData dataWithContentsOfFile:ratingsJSON];
|
||||||
ratingsDictionary = [[jsonDecoder objectWithData:[NSData dataWithContentsOfFile:ratingsJSON]] retain];
|
|
||||||
|
if (data) {
|
||||||
|
ratingsDictionary = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
|
||||||
|
} else {
|
||||||
|
ratingsDictionary = [[NSMutableArray alloc] init];
|
||||||
|
}
|
||||||
|
|
||||||
// construct movie ratings
|
// construct movie ratings
|
||||||
ratings = [[NSMutableArray alloc] init];
|
ratings = [[NSMutableArray alloc] init];
|
||||||
|
|||||||
Reference in new issue
Block a user