AutomaticCoder

码农软件 · 软件分类 · JSON/BSON开发包 · 2019-04-01 09:11:38

软件介绍

Automatic Coder 可根据 JSON 字符串自动生成对应的 Objective-C 处理代码。

示例代码:

    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://zxapi.sinaapp.com"]];
    NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
    NSDictionary *json = [data objectFromJSONData];

    //init object
    Person *person = [[Person alloc] initWithJson:json];
    NSLog(@"%@",person.name);                //http://zhangxi.me
    NSLog(@"%@",person.male?@"男":@"女");     //男
    NSLog(@"%ld",person.girlFriends.count);   //3


    //write to file
    BOOL result = [NSKeyedArchiver archiveRootObject:person toFile:@"./person.data"];
    NSLog(@"%@",result?@"success":@"failure");   //success


    //read from file
    Person *thePerson = [NSKeyedUnarchiver unarchiveObjectWithFile:@"./person.data"];

    NSLog(@"%@",thePerson.name);                //http://zhangxi.me
    NSLog(@"%@",thePerson.male?@"男":@"女");     //男
    NSLog(@"%ld",thePerson.girlFriends.count);   ///3

本文地址:https://codercto.com/soft/d/2608.html

数据结构与算法(Java语言版)

数据结构与算法(Java语言版)

(美) Adam Drozdek著;周翔 / 机械工业出版社 / 2003-07-01 / 49.50元

数据结构与算法:Java语言版,ISBN:9787111119029,作者:(美)Adam Drozdek著;周翔[等]译;周翔译一起来看看 《数据结构与算法(Java语言版)》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具