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

Related Questions

I have a very simple UserControl as shown below. I'm trying to get the
I have a very simple class named person which is given below , I
I have a very simple class with only one field member (e.g. String). Is
So I have a very simple class that has a method called getThumbUrl() but
I have this very simple C++ class: class Tree { public: Node *head; };
Let's say I have a very simple PrototypeJS class that looks like this: var
i'm missing something fundamental here. i have a very simple custom class that draws
I have a very simple scenario, using NHibernate: one abstract base class animal; two
I have a very simple code: package mygame; public class RunGame { public static
I have a class that uses org.apache.ant and the class is very simple, it's

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.