Question: 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

```

Answer: 
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.
```
 reminderSchedule.unit = [NSNumber numberWithInt:1];

```

This will save an NSObject of type: NSNumber, rather than a raw integer.