Password test in 1st Tab.m to load a loginView gives class error?
- by Michael Robinson
I have a name and password in NSUserDefaults for login. I have this in my 1stTab View.m class to test for presence and load a login/signup loginView.xib modally if there is no password or name stored in the app.
Here is the pulling of the defaults:
-(void)refreshFields {
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    usernameLabel.text = [defaults objectForKey:kUsernameKey];
    passwordLabel.text = [defaults objectForKey:kPasswordKey];
{
Here is the Test:
- (void)viewDidAppear:(BOOL)animated {
        [self refreshFields];
        [super viewDidAppear:animated];
    if ([usernameLabel.text length] == 0 || [passwordLabel.text length] == 0)
{
    LoginViewController * vc = [[[LoginViewController alloc] initWithNibName:@"LoginView" bundle:nil] autorelease];
    [self presentModalViewController:vc animated: false];
}
else 
{
    [[self tableView ]reloadData];
}
}
Thanks in advance, I'm getting this error in the console: 
* Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key usernameLabel.'