title: iOS NSObject class setting values
body: <p>I don't know if I am being totally thick or just blind. I'm having problems getting and setting a member class I have created. </p>
  
  <p>Member.h</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @interface Member : NSObject {
  
      NSInteger *MemberID;
      NSString *FirstName;
      NSString *LastName;
      NSString *EmailAddress;
      NSString *DeviceID;
      NSString *Password;
      BOOL *LoggedIn;
  }
  
  @property (nonatomic, assign) NSInteger *MemberID;
  @property (nonatomic, retain) NSString *FirstName;
  @property (nonatomic, retain) NSString *LastName;
  @property (nonatomic, retain) NSString *EmailAddress;
  @property (nonatomic, retain) NSString *DeviceID;
  @property (nonatomic, retain) NSString *Password;
  @property (nonatomic, assign) BOOL *LoggedIn;
  
  - (id)initWithName:(NSInteger *)aMemberID FirstName:(NSString*)aFirstName LastName:(NSString *)aLastName EmailAddress:(NSString *)aEmailAddress DeviceID:(NSString *)aDeviceID  LoggedIn:(BOOL *)aLoggedIn Password: (NSString *)aPassword;
  
  
  @end
  </code></pre>
  
  <p>Member.m</p>
  
  <pre><code>#import "Member.h"
  
  @implementation Member
  @synthesize FirstName, LastName, EmailAddress, DeviceID, LoggedIn, Password, MemberID;
  
  
  - (id)initWithName:(NSInteger *)aMemberID FirstName:(NSString *)aFirstName LastName:(NSString *)aLastName EmailAddress:(NSString *)aEmailAddress DeviceID:(NSString *)aDeviceID LoggedIn:(BOOL *)aLoggedIn Password:(NSString *)aPassword
  {
  
      self.MemberID = aMemberID;
      self.FirstName = aFirstName;
      self.LastName = aLastName;
      self.EmailAddress = aEmailAddress;
      self.DeviceID = aDeviceID;
      self.LoggedIn = aLoggedIn;
      self.Password = aPassword;
      return self;
  
  }
  
  // encoding for saving
  
  - (void)encodeWithCoder:(NSCoder *)encoder {
      //Encode properties, other class variables, etc
      [encoder encodeInteger:self.MemberID forKey:@"MemberID"];
      [encoder encodeObject:self.FirstName forKey:@"FirstName"];
      [encoder encodeObject:self.LastName forKey:@"LastName"];
      [encoder encodeObject:self.EmailAddress forKey:@"EmailAddress"];
      [encoder encodeObject:self.DeviceID forKey:@"DeviceID"];
      [encoder encodeBool:self.LoggedIn forKey:@"LoggedIn"];
      [encoder encodeObject:self.Password forKey:@"Password"];
  }
  
  - (id)initWithCoder:(NSCoder *)decoder {
      if((self = [super init])) {
          //decode properties, other class vars
          self.MemberID = [decoder decodeIntegerForKey:@"MemberID"];
          self.FirstName = [decoder decodeObjectForKey:@"FirstName"];
          self.LastName = [decoder decodeObjectForKey:@"LastName"];
          self.EmailAddress = [decoder decodeObjectForKey:@"EmailAddress"];
          self.DeviceID = [decoder decodeObjectForKey:@"DeviceID"];
          self.LoggedIn = [decoder decodeBoolForKey:@"LoggedIn"];
          self.Password = [decoder decodeObjectForKey:@"Password"];
      }
      return self;
  }
  
  @end
  </code></pre>
  
  <p>Then in appdelegate, I am setting up the member class.</p>
  
  <p>MyAppDelegate.m</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
  
  
      //set up the members item
      self.member = [Member alloc];
  }
  </code></pre>
  
  <p>Then in my view controllers, I am referencing the app delegate and trying to set the member object with values. I just don't think it's saving it though? </p>
  
  <p>//eg of setting</p>
  
  <pre><code>appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
  appDelegate.member.FirstName = @"Matt";
  appDelegate.member.LastName = @"Facer";
  appDelegate.member.EmailAddress = @"matt@facer.com";
  appDelegate.member.MemberID = 12;
  appDelegate.member.LoggedIn = YES;
  appDelegate.saveLogin = [switchRememberLogin isOn];
  NSLog(@"member name=%@",appDelegate.member.FirstName); //equals (NULL)
  </code></pre>
  
  <p>Thanks for any help!</p>