0

I recently had to modify the data model of a project I didn't started. I just added the attribute "ordered" on some entities, and regenerated the whole thing in classes, about 10.

The issue is, I'm now constantly getting a SIBAGRT exception, and I cannot figure out why. It happens when I call the functions on my managed object, such as:

[currentArticle removePages:currentArticle.pages];

With this line I'm trying to empty an article from all its pages, at first I thought this might crash because there are no pages, so nothing to delete. So I turned this line into:

if ([currentArticle.pages count ] > 0){
    [currentArticle removePages:currentArticle.pages];
}

It turned out that this specific line was not called anymore, but another generated function gave me the same SIBAGRT issue:

[currentAsset addMediasObject:currentMedia];

Both currentAsset and currentMedia are not null. po currentAsset gives

$2 = 0x08870c50 <Asset: 0x8870c50> (entity: Asset; id: 0x8870cb0 <x-coredata:///Asset/t6C0C3F05-8242-4889-90B0-DDF9A86EE16924> ; data: {
    arrowColor = nil;
    gallery = nil;
    id = 0;
    medias =     (
    );
    name = "Couv-La-vie-en-rose";
    page = nil;
    parentGallery = nil;
    style = "full-page";
    type = picture;
    value = "";
})

po currentMedia gives

$3 = 0x088778b0 <Media: 0x88778b0> (entity: Media; id: 0x8877910 <x-coredata:///Media/t6C0C3F05-8242-4889-90B0-DDF9A86EE16925> ; data: {
    asset = nil;
    "media_description" = "";
    "media_uri" = "La-vie-en-rose.jpg";
    "sub_uri" = "";
    "thumbnail_uri" = "";
    "video_id" = "Home_video_AH11";
})

It was perfectly working before I add the "ordered" attribute and regenerate the whole thing.

If anyone has a clue, that would be much appreciated.

Cheers!

Thomas Pujolle
  • 155
  • 1
  • 1
  • 11
  • I had similar issues and simple clean-and-rebuild did help, maybe try it first? – Michał Ciuba May 30 '13 at 09:58
  • There is a known bug in the autogenerated accessor methods for *ordered* to-many relationships. See http://stackoverflow.com/questions/7385439/exception-thrown-in-nsorderedset-generated-accessors for the problem and workarounds. – Martin R May 30 '13 at 09:58
  • Neither your `Media` entity nor your `Asset` entity have this new "ordered" attribute-- at least that's what your debugger results show. Where did you add this attribute? – Tom Harrington May 30 '13 at 15:33
  • You altered the model, did you do a migration? Is there existing data in place? What is the actual crash? Posting the full crash log will help us to see what the issue is. – Marcus S. Zarra May 30 '13 at 17:13

0 Answers0