0

を使用するアプリの開発の初期段階ではCore DataRestKitデータ モデルを大幅に変更することが多く、移行について考える必要さえほとんどまたはまったくありません。

ロジックを次のようにしたい:

IF (there is a foolproof, automatic migration path) THEN
   TRY { foolproof path; }
   CATCH { brute path; }
ELSE
   brute path;

brute path:

IF (SqlLiteDatabase exists) THEN
   DELETE IT;

CREATE SqlLiteDatabase;

今持っているものは、正直わかりません…

RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:[[RestKitClientConfigurator webServiceConfiguration] baseURL]]];

NSManagedObjectModel *managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil];
RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel];
objectManager.managedObjectStore = managedObjectStore;

[managedObjectStore createPersistentStoreCoordinator];
NSString *storePath = [RKApplicationDataDirectory() stringByAppendingPathComponent:@"CTISDB.sqlite"];
NSString *seedPath = [[NSBundle mainBundle] pathForResource:@"RKSeedDatabase" ofType:@"sqlite"];

NSDictionary *optionsDictionary =
[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]
                            forKey:NSMigratePersistentStoresAutomaticallyOption];

NSError *error;
NSPersistentStore *persistentStore = [managedObjectStore addSQLitePersistentStoreAtPath:storePath fromSeedDatabaseAtPath:seedPath withConfiguration:nil options:nil error:&error];
NSAssert(persistentStore, @"Failed to add persistent store with error: %@", error);

しかし、基本的に、私が本当に疑問に思っているのは、これは今では十分に一般的な問題 (仮想デバイスを常にリセットしなければならない) ではないのCore Dataでしょうか?

そうでない場合、上記のアルゴリズムの実装を妨げるこの操作の複雑さについて何が欠けていますか?

4

1 に答える 1