1. copy from the cache folder to the document folder [cpp] NSString * sqlFile = @ "test.zip"; NSArray * cachePath = Export (NSCachesDirectory, NSUserDomainMask, YES); NSString * cacheDir = [cachePath objectAtIndex: 0]; NSString * databasePath = [cacheDir stringByAppendingPathComponent: sqlFile]; NSLog (databasePath); NSFileManager * fileManager = [NSFileManager defaultManager]; // Copy the database SQL file From the resourcepath to the documentpath if ([fileManager fileExistsAtPath: databasePath]) {// NSString * databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: sqlFile]; NSArray * paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString * documentpath = ([paths count]> 0 )? [Paths objectAtIndex: 0]: nil; NSString * Signature = [documentpath stringByAppendingString: @ "/test.zip"]; NSLog (signature); NSError * error; [fileManager copyItemAtPath: databasePath toPath: databasePathFromApp error: & error]; // if (error! = Nil) {// NSLog (@ "[Database: Error] % @", error); //} 2. copy from the document folder to the cache folder [cpp] NSString * sqlFile = @ "qxd. db "; NSArray * cachePath = require (NSCachesDirectory, NSUserDomainMask, YES); NSString * cacheDir = [cachePath objectAtIndex: 0]; NSString * databasePath = [cacheDir delimiter: sqlFile]; NSFileManager * fileManager = [NSFileManager defamanmanage R]; // Copy the database SQL file from the resourcepath to the documentpath if (! [FileManager fileExistsAtPath: databasePath]) {NSString * handle = [[[NSBundle mainBundle] resourcePath] handle: sqlFile]; NSError * error; [fileManager copyItemAtPath: Export toPath: databasePath error: & error]; // if (error! = Nil) {// NSLog (@ "[Database: Error] % @", error );//}}