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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:51:45+00:00 2026-05-30T07:51:45+00:00

So my CoreData model has one entity for the time being. It has several

  • 0

So my CoreData model has one entity for the time being. It has several attributes, for testing purpose I set these attributes in the applicationdidfinishlaunching method. As soon as I set an NSNumber (Integer 16 or float) attribute it gets a EXC_BAD_ACCESS exception.

The string attributes work and gets stored, I tested this with a fetch.
If I set the Integer 16 number to 0 it does not crash but I guess it’s because it gets assigned nil then.

Core data NSManagedObject created by xcode:

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

@interface ReminderSchedule : NSManagedObject

@property (nonatomic, retain) NSNumber * intervalSize;
@property (nonatomic, retain) NSNumber * intervalType;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSNumber * quantity;
@property (nonatomic, retain) NSDate * startDate;
@property (nonatomic, retain) NSNumber * unit;

@end

Inside the applicationdidfinishlaunching method in the appdelegate

ReminderSchedule *reminderSchedule;
reminderSchedule = [NSEntityDescription insertNewObjectForEntityForName:@"ReminderSchedule" inManagedObjectContext:self.managedObjectContext];

reminderSchedule.unit = 1; <==== EXC_BAD_ACCESS
reminderSchedule.quantity = 4.0f; <==== EXC_BAD_ACCESS
reminderSchedule.name = @"this works";
reminderSchedule.intervalType = 2; <==== EXC_BAD_ACCESS
reminderSchedule.intervalSize = 2; <==== EXC_BAD_ACCESS

[self.managedObjectContext save:nil]; //just for testing, never gets here
  • 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-30T07:51:46+00:00Added an answer on May 30, 2026 at 7:51 am

    You are passing in an ‘int’ and not an NSNumber.

    Try this:

    reminderSchedule.unit = [NSNumber numberWithInt:1]; // this won't crash
    

    You can also reformat your @property to NSInteger. This will allow you to pass in a straight integer.

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

Sidebar

Related Questions

When I have a CoreData entity named, say, 'Book', which has a one-to-one relationship
In my core data model I have a Person entity that has a to
I have set up a Core Data model that includes an entity, Item with
My model is setup so Business has many clients, Client has one business. Inverse
My Core Data model contains an entity, Shape, that has two self-referential relationships, which
I am struggling with designing a coreData model where I have only one type
I have a CoreData model with an object bar which has a to-many relationship
in my Core Data model, I have an entity which has got a date
I have a Department entity which has a one-to-many relationship to an Employee entity.
Lets say I have a core data model like this one: Item attributes: name

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.