Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // untitled.m
- // dct-iphone
- //
- // Created by Ryan Gravener on 2/1/09.
- // Copyright 2009 __MyCompanyName__. All rights reserved.
- //
- #import "User.h"
- #import "JSON/JSON.h"
- @implementation User
- @synthesize userId;
- @synthesize username;
- @synthesize password;
- -(id)init {
- self.userId = 0;
- self.username = nil;
- self.password = nil;
- return self;
- }
- -(NSString*) toJSON {
- NSString *json = [NSString init];
- return json;
- }
- +(id) fromJSON: (NSString*) json {
- SBJSON *j = [SBJSON new];
- NSDictionary* d = (NSDictionary*)[j objectWithString:json error:NULL];
- User *u = [User init];
- if([d objectForKey: @"id"]!=nil) {
- u.userId = (long)[d objectForKey: @"id"];
- }
- return nil;
- //return [User alloc];
- //JSON json = [[JSON alloc]];
- }
- @end
Add Comment
Please, Sign In to add comment