Question

I have following Problem:

First up... i use MagicalRecord for the whole CoreData thing

  • I have two Entities: A and B
  • They have a relation between each other
  • I create one instance of Entity A
  • I create several instances ob Entity B and set the relation
  • I don't call [[NSManagedObjectContext defaultContext] save];
    • It's fine
    • The relation is ok... I can check it using the findByAttribute method
  • If I call this save then the relation is destroyed...
    • the same check using findByAttribute does not find results any more

I have absolutely no clue what I am doing wrong or if it's a bug in CoreData / MagicalRecord...

I made a sample project showing the problem. https://github.com/bliblablo/MagicalRecordsProblem

You can see the problem by following this steps:

  • click "create"
  • click "add"
  • click "check"
  • see the log output for results
  • click "save"
  • click "check" again and see the problem in the log :)

Any help is really appreciated!!! Thanks a lot!

Was it helpful?

Solution

Sounds like the problem I was having with temporary ObjectID's not getting refreshed in the default context.

See my answer on NSPredicate not executed for details.

If you haven't already sorted it out, try checking the ObjectID of the NSManagedObject instances at various points. Especially if you (or Magical Record) are using the object as part of an NSPredicate to do the later fetches.

OTHER TIPS

I think this is not MR bug. It is a bug from core data. See this post. http://wbyoung.tumblr.com/post/27851725562/core-data-growing-pains

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top