UI---JSON数据解析
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UI---JSON数据解析相关的知识,希望对你有一定的参考价值。
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 }
以上是关于UI---JSON数据解析的主要内容,如果未能解决你的问题,请参考以下文章
片段(Java) | 机试题+算法思路+考点+代码解析 2023