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

  • Home
  • SEARCH
  • 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 9126765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:07:02+00:00 2026-06-17T07:07:02+00:00

Possible Duplicate: Why is my object not key value coding-compliant? I’m having a dictionary

  • 0

Possible Duplicate:
Why is my object not key value coding-compliant?

I’m having a dictionary and I want to add keys/values to a custom class, but i always get the error, that the class is not KVC compliant, but the Apple documents state that it should be.

My code:

ContactObject.h:

@interface ContactObject : NSObject
     + (ContactObject *)testAdding;
@end

ContactObject.m:

@implementation ContactObject

- (id)init {
    self = [super init];
    if (self) {
        // customize

    }

    return self;

}

+ (ContactObject *)testAdding
{
    // create object
    ContactObject *theReturnObject = [[ContactObject alloc] init];

    [theReturnObject setValue:@"Berlin" forKey:@"city"];
    [theReturnObject setValue:@"Germany" forKey:@"state"];

    return theReturnObject;

}

@end

I think I’m missing something very stupid 🙂

Please, any help appreciated …

Greetings,
matthias

  • 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-06-17T07:07:05+00:00Added an answer on June 17, 2026 at 7:07 am

    Actually to be KVC compliant:

    How you make a property KVC compliant depends on whether that property is an attribute, a to-one relationship, or a to-many relationship. For attributes and to-one relationships, a class must implement at least one of the following in the given order of preference (key refers to the property key):

    1. The class has a declared property with the name key.
    2. It implements accessor methods named key and, if the property is mutable, setKey:. (If the property is a Boolean attribute, the getter accessor method has the form isKey.)
    3. It declares an instance variable of the form key or _key.

    I don’t see any of these three implemented. You need to have at least properties that you are trying to set through KVC, the default NSObject implementation is able to set properties through setValue:forKey: but you must declare them.

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

Sidebar

Related Questions

Possible Duplicate: What are the reasons why Map.get(Object key) is not (fully) generic According
Possible Duplicate: What are the reasons why Map.get(Object key) is not (fully) generic Why
Possible Duplicate: What are the reasons why Map.get(Object key) is not (fully) generic From
Possible Duplicate: What are the reasons why Map.get(Object key) is not (fully) generic This
Possible Duplicate: What are the reasons why Map.get(Object key) is not (fully) generic This
Possible Duplicate: What are the reasons why Map.get(Object key) is not (fully) generic I
Possible Duplicate: What are the reasons why Map.get(Object key) is not (fully) generic Java
Possible Duplicate: What are the reasons why Map.get(Object key) is not (fully) generic Why
Possible Duplicate: Object reference not set to an instance of an object errors when
Possible Duplicate: Why is the destructor not called for the returned object from the

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.