Monday, 2 February 2015

Objective C + Parse Json From Bundle

NSMutableArray *arrayAdventureList = [self dataFromJSONFileNamed:@"Adventure"]; -(NSMutableArray *)dataFromJSONFileNamed:(NSString *)fileName { NSString *filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"json"]; NSData *fileData = [NSData dataWithContentsOfFile:filePath]; NSError *error = nil; NSMutableDictionary *dicAdventureList = [NSJSONSerialization JSONObjectWithData:fileData options:kNilOptions error:&error]; return [dicAdventureList objectForKey:@"adventure_list"]; }

No comments:

Post a Comment