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 3797586
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:25:37+00:00 2026-05-19T13:25:37+00:00

From my understanding of Core Data, all that is necessary for primitive accessors to

  • 0

From my understanding of Core Data, all that is necessary for primitive accessors to work is the @dynamic directive for the property name (as well as declaring primitive accessors for that property within the entity implementation).

For some reason, when using the generated primitive accessor the setState: method is not modifying the state property:

- (int)state 
{
    NSNumber * tmpValue;

    [self willAccessValueForKey:@"state"];
    tmpValue = [self primitiveState];
    [self didAccessValueForKey:@"state"];

    return [tmpValue intValue];
}

- (void)setState:(int)value 
{
    [self willChangeValueForKey:@"state"];
    [self setPrimitiveState:[NSNumber numberWithInt:value]];
    [self didChangeValueForKey:@"state"];
}

while using the key-value-coding version does modify the state property

- (int)state 
{
    NSNumber * tmpValue;

    [self willAccessValueForKey:@"state"];
    tmpValue = [self primitiveValueForKey:@"state"];
    [self didAccessValueForKey:@"state"];

    return [tmpValue intValue];
}

- (void)setState:(int)value 
{
    [self willChangeValueForKey:@"state"];
    [self setPrimitiveValue:[NSNumber numberWithInt:value] forKey:@"state"];
    [self didChangeValueForKey:@"state"];
}

in both cases, I primitive accessors are declared as follows (and as per Apple’s example and code generation):

@interface Post (CoreDataGeneratedPrimitiveAccessors)

- (NSNumber *)primitiveState;
- (void)setPrimitiveState:(NSNumber *)value;

@end

I’m a bit at a loss to why this would be. Any help would be greatly appreciated!

  • 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-19T13:25:37+00:00Added an answer on May 19, 2026 at 1:25 pm

    After tremendous amounts of head-scratching, debugging, fiddling and guess-and-check, I’ve finally figured out what the problem is: Core Data primitive accessors AREN’T dynamically generated if you define those attributes as instance variables. I had defined them for debugging purposes (as GBD cannot see the values of properties without defined ivars, it seems), and this prevented primitive accessors from being generated correctly. This is something that Apple should really document in some form. As it’s very difficult to discover on one’s own. I hope this helps others who’ve been having the same issue!

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

Sidebar

Related Questions

From my understanding, the soft keyboard is actually a dialog window that underlies all
From what little understanding of Cassandra I have, it seems that data locality is
From my understanding of the docs this general approach should work: begin try1 rescue
MariaDB 5.3 introduced dynamic columns. From my understanding the next version of mysql should
My understanding is that it's advised testers are separate from developers, i.e you obviously
From my understanding Perl traditionally has only included core functionality, and people install additional
I am having trouble understanding how to best use Core Data to solve this
This question covncerns my lack of understanding of how to use the core data
I have a tableview using NSFetchedResultsController to load data from the Core Data store,
Its my understanding that by adding the ScaffoldColumn(false) annotation to an property in a

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.