I have a core data database which has (for now) 2 entities Product and CompetingProduct, CompetingProduct relation is set to-many with products.
I create 2 mock Products and 2 mock Competing products and set relation between them .. everything works files.. Saved to database, also NSlog, “po” them.. all is good.
Now.. when i restart the app or i request all objects of competing product type from a different view.. i get Relation fault for the relation between Competing Product and Products (although i added them earlier, and saved)
I know that about the lazy loading of data core but here is not the case because when i try [NSSet allObjects] (also po, nslog – nothing) it returns 0 objects which normally should get objects.
Note: Immediately after i call saveChanges – all things work
Absolutely ANY help will be greatly appreciated and win you my respect and of course a couple of beers
Thanks!
If I understand the description of the problem correctly, it could be caused by not having a recipocal relationship set from CompetingProduct to Product.
If the relationship is:
…and not:
… then you will be able to find CompetingProducts starting with a Product but you will be able to find a Product by starting with a CompetingProduct.
If this is not the problem then it sounds like you may have multiple context and are not saving the one the changes are made in.