Note that there are some explanatory texts on larger screens.

plurals
  1. POCore Data fails to generate primitive accessors
    text
    copied!<p>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).</p> <p>For some reason, when using the generated primitive accessor the setState: method is <em>not</em> modifying the state property:</p> <pre><code>- (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"]; } </code></pre> <p>while using the key-value-coding version <em>does</em> modify the state property</p> <pre><code>- (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"]; } </code></pre> <p>in both cases, I primitive accessors are declared as follows (and as per Apple's example and code generation):</p> <pre><code>@interface Post (CoreDataGeneratedPrimitiveAccessors) - (NSNumber *)primitiveState; - (void)setPrimitiveState:(NSNumber *)value; @end </code></pre> <p>I'm a bit at a loss to why this would be. Any help would be greatly appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload