Guest User

Untitled

a guest
May 11th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. //
  2. // untitled.m
  3. // dct-iphone
  4. //
  5. // Created by Ryan Gravener on 2/1/09.
  6. // Copyright 2009 __MyCompanyName__. All rights reserved.
  7. //
  8.  
  9. #import "User.h"
  10. #import "JSON/JSON.h"
  11.  
  12. @implementation User
  13.  
  14. @synthesize userId;
  15. @synthesize username;
  16. @synthesize password;
  17.  
  18. -(id)init {
  19. self.userId = 0;
  20. self.username = nil;
  21. self.password = nil;
  22. return self;
  23. }
  24.  
  25. -(NSString*) toJSON {
  26. NSString *json = [NSString init];
  27. return json;
  28. }
  29.  
  30. +(id) fromJSON: (NSString*) json {
  31. SBJSON *j = [SBJSON new];
  32. NSDictionary* d = (NSDictionary*)[j objectWithString:json error:NULL];
  33. User *u = [User init];
  34. if([d objectForKey: @"id"]!=nil) {
  35. u.userId = (long)[d objectForKey: @"id"];
  36. }
  37. return nil;
  38. //return [User alloc];
  39. //JSON json = [[JSON alloc]];
  40. }
  41.  
  42. @end
Add Comment
Please, Sign In to add comment