objective c - Pre populate Core data Copy Issue -
i pre-populating core data existing .sqlite following code:
// put down default db if doesn't exist nserror *error = nil; nsfilemanager *filemanager = [nsfilemanager defaultmanager]; if (![filemanager fileexistsatpath:[storeurl path]]) { nsstring *defaultstorepath = [[nsbundle mainbundle] pathforresource:@"xyz" oftype:@"sqlite"]; if (defaultstorepath) { [filemanager copyitematpath:defaultstorepath topath:[storeurl path] error:&error]; } }
it working until upgraded xcode , copies .sqlite file desired location not of same size. pre populated .sqlite file of 4.7 mb , when it's copied there above code it's of size 3.2 mb. , gives following error:
sqlite error code:1, 'no such table: z_metadata'
note: works fine if manually replace .sqlite file in documents.
Comments
Post a Comment