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 "JSONKit.h"
|
||||
|
||||
@implementation MP42Ratings
|
||||
|
||||
@synthesize ratings;
|
||||
@@ -30,8 +28,13 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
JSONDecoder *jsonDecoder = [JSONDecoder decoder];
|
||||
ratingsDictionary = [[jsonDecoder objectWithData:[NSData dataWithContentsOfFile:ratingsJSON]] retain];
|
||||
NSData *data = [NSData dataWithContentsOfFile:ratingsJSON];
|
||||
|
||||
if (data) {
|
||||
ratingsDictionary = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
|
||||
} else {
|
||||
ratingsDictionary = [[NSMutableArray alloc] init];
|
||||
}
|
||||
|
||||
// construct movie ratings
|
||||
ratings = [[NSMutableArray alloc] init];
|
||||
|
||||
Reference in new issue
Block a user