JSON 保存到本地

    NSArray *array = [NSJSONSerialization JSONObjectWithData:[NSData data] options:NSJSONReadingAllowFragments error:nil];

    NSArray *docs = NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory, NSUserDomainMask, YES);

    NSString *path = [docs[0] stringByAppendingPathComponent:@"json.plist"];

    [array writeToFile:path atomically:YES];

 

红色[NSData data]是从网络来的数据 

posted on 2016-04-14 20:40  哈利波特大  阅读(495)  评论(0编辑  收藏  举报