0

I am using the universal framework from the link https://github.com/kstenerud/iOS-Universal-Framework. It am including the core data managed object model and other model classes inside the framework itself. But, I am having serious trouble to migrate the model. I have a single momd file like Model.xcdatamodeld and inside it are versioned model which are named like 1.xcdatamodel, 2.xcdatamodel, 3.xcdatamodel and so on. I have also included the model in compile sources in the build phases inside the library.

I have also the options set for the model to infer the migration automatically. Although the model is inside the framework, it needs some reference inside the main application bundle and so I have created a link to point the file inside the framework. But, I could not get migration working. Is there some thing serious, I am missing or is it not possible to reference the modal inside the framework to migrate automatically.

Any help would be greatly appreciated.

4

1 に答える 1

0

問題の解決策があります。しかし、それはハックのようです。私は現在、モーダルバージョンを直接使用してモデルを参照しています。

NSURL *modelURL = [[[NSBundle mainBundle] resourceURL] URLByAppendingPathComponent:@"Modals.momd/3.mom"];
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];

しかし、私はこの解決策にあまり満足していません。これを達成するためのより良い方法はありますか?

于 2012-09-19T18:26:31.043 に答える