Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 381919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:07:55+00:00 2026-05-12T15:07:55+00:00

I have a very simple class (shown below), however every time I run it,

  • 0

I have a very simple class (shown below), however every time I run it, it returns:

Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key field1.’

I am drawing this nib file to the screen in the following way:

UIViewController *backViewController = [[UIViewController alloc] initWithNibName:@"myViewBack" bundle:[NSBundle mainBundle]];

UIView *backView = backViewController.view;

[self addSubview:backView];

The following is my code for the class that is set to File’s Owner:

.h

#import <Foundation/Foundation.h>


@interface myViewBack : NSObject {

    IBOutlet UITextField *field1;
    IBOutlet UITextField *field2;

    IBOutlet UIView *view;
}

@property (nonatomic, retain) IBOutlet UITextField *field1;
@property (nonatomic, retain) IBOutlet UITextField *field2;

@end

.m

#import "myViewBack"


@implementation myViewBack

@synthesize field1;
@synthesize field2;


- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];

    return YES;
}

@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T15:07:56+00:00Added an answer on May 12, 2026 at 3:07 pm

    What object contains a field called ‘username’? You are likely using an object that is not actually the type you think it is. If it is trying to access a field called ‘username’ on an object that doesn’t have that as an instance variable, it will crash.

    Try running in debug (Command-Y). When the app crashes, it should stop on the line where it crashed. At this point, bring up the debugger window (Ctrl-Command-Y) and look for the last line in the Threads view (upper left-hand corner in the debugger) that is in black (not gray). This is the last line of your code before it accessed something that doesn’t exist. Click on that line and it should show you what object caused the issue.

    None of the code you provided specifies ‘username’ as an instance variable, so it’s got to be somewhere else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 245k
  • Answers 245k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer FrontPage extensions are for developing (or rather managing pages and… May 13, 2026 at 8:14 am
  • Editorial Team
    Editorial Team added an answer If you are using Python 2.6 or higher, you can… May 13, 2026 at 8:14 am
  • Editorial Team
    Editorial Team added an answer Wikipedia is helpful. In the context of relational databases, a… May 13, 2026 at 8:14 am

Related Questions

I am working on a two-level menu like the Dynamic Drive examples on this
I have a program that works fine on VS2008 and Vista , but I'm
I have created 2 forms in VS Studio 2008 Express Edition and declare them
This is my first question on S.O. I have a very odd problem. Below

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.