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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:37:00+00:00 2026-06-07T13:37:00+00:00

when I try to set the variable eventId of my NSManagedObject (Event) I get

  • 0

when I try to set the variable eventId of my NSManagedObject (Event) I get ther error EXC_BAD_ACCESS.
I don’t know the reason.

Here’s the code of my class Event

@interface Event : NSManagedObject 

@property (assign)              NSInteger   eventId;

@end


@interface Event (PrimitiveAccessors)
- (NSInteger)primitiveEventId;
- (void)setPrimitiveEventId:(NSInteger)event_id;
@end



@implementation Event
@dynamic eventId;

...

-(NSInteger)eventId
{
    [self willAccessValueForKey:@"eventId"];
    NSInteger id = [self eventId];
    [self didAccessValueForKey:@"eventId"];
    return id;
}

-(void)setEventId:(NSInteger)event_id
{
    [self willChangeValueForKey:@"eventId"];
    [self setPrimitiveEventId:event_id]; //Here I get the error
    [self didChangeValueForKey:@"eventId"];
}

...

Anyone can solve the problem?

Thanks for help

  • 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-07T13:37:03+00:00Added an answer on June 7, 2026 at 1:37 pm

    If you look closely at the documentation, you’ll see that the primitive accessor methods for the scalar attribute double length in the example still use NSNumber * arguments and return values:

    @interface MyManagedObject (PrimitiveAccessors)
    @property (nonatomic, retain) NSNumber *primitiveLength;
    @end
    

    [Note: I added the * that was missing in the original code snippet in Apple’s documentation.]

    So try declaring your primitive accessors with NSNumber * arguments and return values.

    Or if you really must, consider implementing your own primitive accessor methods.

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

Sidebar

Related Questions

When I try to set the z variable in the code below, I get
How to set global variable. $(document).ready(function() { $(a.action).click(function(event) { var tempResponse = ; $.get(,
Every time try to set the value of any variable in my model object,
I use SNMP4J and try to set some value. Variable var = OctetString.fromHexString(v); VariableBinding
When I try to set the width of a BorderContainer to a bindable variable
I am getting the EXC_BAD_ACCESS error when trying to set a value inside a
How can I set environment variable in Cruisecontrol? If I try to do it
I need to set JavaScript variable by php variable with out ajax. I try
My problem is that I have to set a variable in a try statement
In the ASP.net, I try to set a variable value to hidden field, but

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.