Automatic generate Objective-C code by JSON string.Support <NSCoding> .
Objective-C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
AutomaticCoder.xcodeproj fix bug( not finish yet) Aug 30, 2015
AutomaticCoder add edit menu Aug 30, 2015
.gitignore init project Aug 20, 2012
AutomaticCoder.zip clean commit Aug 22, 2012
README.md add screenshot Apr 10, 2013
icons.icns 我也忘了更新什么了.. Sep 4, 2012

README.md

Automatic Coder

截图1 截图2

Overview

Automatic generate Objective-C code by JSON string.Support <NSCoding>.

Do you want other code?Tell me i'll add it.

System

Xcode 4.4 or later

Mac OS 10.7 or later

Feedback

http://zhangxi.me

zhangxi_1989@sina.com

    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