标签:
1 #import "AppDelegate.h" 2 3 @implementation AppDelegate 4 5 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 6 { 7 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 8 // Override point for customization after application launch. 9 self.window.backgroundColor = [UIColor whiteColor]; 10 [self.window makeKeyAndVisible]; 11 12 13 // 1.获得文件路径 14 NSString *path = [[NSBundle mainBundle] pathForResource:@"studentJSON" ofType:@"txt"]; 15 16 NSData *data = [NSData dataWithContentsOfFile:path]; 17 18 // 2.json解析 19 id object = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; 20 // NSLog(@"%@", [object class]); 21 NSLog(@"%@", object); 22 23 24 [_window release]; 25 return YES; 26 } 27 -(void)dealloc 28 { 29 [_window release]; 30 [super dealloc]; 31 }
标签:
原文地址:http://www.cnblogs.com/-Eric-Liu/p/5563987.html