0

我将我的应用程序的存储方法从简单的文件写入更新到 CoreData。为了保存以前版本的所有数据,我编写了一个应用程序委托调用的迁移方法

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [self checkForPreCoreDataFilesAndMigrate];
    //normal launching 
}

checkForPreCoreDataFilesAndMigrate方法从 CoreData 数据库中的先前版本迁移所有文件。

我现在的问题是我想阻止 appdelegate 执行其他操作,例如使用空数据库加载 Main ViewController(这基本上可以工作,但会扰乱迁移过程)。

我怎样才能做到这一点?有没有一种解决方案,我仍然可以显示迁移方法设置的内容UIAlterViewUIProgressView

4

1 回答 1

1

您可以使用以下方法

[self performSelector:@selector(checkForPreCoreDataFilesAndMigrate) onThread:[NSThread mainThread] withObject:nil waitUntilDone:YES];
于 2013-03-25T12:34:51.197 回答