开发者

Core Data Not Saving Relationships Between Objects

开发者 https://www.devze.com 2023-03-14 22:31 出处:网络
I have a project that uses the same xcdatamodel file as another project. In fact it\'s the exact same file. I copied it from one project to the other. I also copied the object files over with a few mo

I have a project that uses the same xcdatamodel file as another project. In fact it's the exact same file. I copied it from one project to the other. I also copied the object files over with a few modifications and put them in a static library that the second project now references. These xcdatamodel and object files work just fine in the original project

In the second project, when the objects are saved the relationships between the objects are not saved. While the app is running the relationships are there as expected, pointers are still in memory but when I exit the app, come back in, then do a fetch on the objects, I get the correct numbe开发者_如何转开发r of objects but all their attributes are nil. The attributes are also managed objects that are in the same context. As far as I can tell from looking at the sqlite DB all the objects are there they just don't point at each other.

EDIT: I am using Xcode 3.2.6


I assume you are doing all this in Xcode 4.

In my experience, I have found it to be extremely buggy using Core Data. Although I am not sure it will fix your problem, you might want to use Xcode 3 to manage this. If you don't have it, here is a torrent. I was having trouble with Xcode 4 so I use Xcode 3 to get my Core Data stuff set up, and then once its set up, I use Xcode 4 for everything else.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号