Note that there are some explanatory texts on larger screens.

plurals
  1. POCore Data EXC_BAD_ACCESS for non-zero integer values
    text
    copied!<p>I have two core data models with int64_t properties. One of them works fine while the other throws EXC_BAD_ACCESS when I try to assign a non-zero value to the integer field. I've read the answers that say to recreate the NSManagedObject child class and I have done with no success. The broken class looks like this:</p> <pre><code>@interface NoteObject : NSManagedObject @property (nonatomic) int64_t remoteID; @property (nonatomic) int64_t remoteArticleID; @property (strong, nonatomic) ArticleObject *article; @property (strong, nonatomic) NSString *status; @property (strong, nonatomic) NSString *token; @property (strong, nonatomic) NSString *title; @property (strong, nonatomic) NSString *noteContent; @property (strong, nonatomic) NSDate *pubDate; @property (strong, nonatomic) NSDate *modDate; @end @implementation NoteObject @dynamic remoteID; @dynamic remoteArticleID; @dynamic article; @dynamic status; @dynamic token; @dynamic title; @dynamic noteContent; @dynamic pubDate; @dynamic modDate; @end </code></pre> <p>The offending line is in this block:</p> <pre><code>_noteObject = [NSEntityDescription insertNewObjectForEntityForName:@"Note" inManagedObjectContext:self.managedObjectContext]; _noteObject.remoteArticleID = 0; // this works _noteObject.remoteArticleID = 1; // this crashes </code></pre> <p>What really has me stumped is that in another model I have the same fields with the same types and they will accept non-zero values without any trouble:</p> <pre><code>bookmarkObject = [NSEntityDescription insertNewObjectForEntityForName:@"Bookmark" inManagedObjectContext:self.managedObjectContext]; bookmarkObject.remoteArticleID = 0; // this works bookmarkObject.remoteArticleID = 1; // this works, too </code></pre> <p>Is there anything in my .xcdatamodeld file that could be causing this?</p> <p><strong>EDIT</strong></p> <p>My data models look like this:</p> <p><img src="https://i.stack.imgur.com/OwSgz.png" alt="NoteObject Data Model"> <img src="https://i.stack.imgur.com/1VcSL.png" alt="BookmarkObject Data Model"></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