0
我有数据库转储,我想在运行时将它加载到iphone上的sqlite数据库。我如何从代码中做到这一点?来自代码的SQLite加载数据库转储
我有数据库转储,我想在运行时将它加载到iphone上的sqlite数据库。我如何从代码中做到这一点?来自代码的SQLite加载数据库转储
目前还不清楚什么是“数据库转储”是的,但假设它是iPhone上的数据模型很容易匹配的SQLite数据库 - 但有窍门的Xcode中抛出
1)重命名。文件从xxx.sqlite到xxx.bin。其他扩展也应该可以工作,但如果你离开它,.sqlite Xcode将对文件进行更改,并且它不会匹配数据模型和崩溃。 Xcode的这个小功能每天花费我一半。
2)将数据库复制到Xcode中的资源文件夹中。
3)启动时将数据库复制到Documents目录,将扩展名重命名为“sqlite”。
Xcode将对文件进行更改,并且它不会匹配数据模型和崩溃。 您是否在应用程序启动时崩溃!? – 2009-12-15 17:36:54
执行提取时发生崩溃,在我的情况下: [self fetchedResultsController] performFetch:&error]。 – zaph 2009-12-15 17:41:21
我在发射 8 CoreData \t 0x000994be crahs - [NSSQLConnection prepareAndExecuteSQLStatement:] + 26 9 CoreData \t 0x000be14c - [_ NSSQLiteStoreMigrator performMigration:] + 244 10 CoreData \t 0x000b6c60 - [NSSQLiteInPlaceMigrationManager migrateStoreFromURL:类型:选择:withMappingModel:toDestinationURL :destinationType:destinationOptions:error:] + 1040 11 CoreData \t 0x000aceb0 - [NSStoreMigrationPolicy(InternalMethods)migrateStoreAtURL:toURL:storeType:options:withManager:error:] + 92 12 CoreData – 2009-12-15 17:44:33