This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSLog(@"Documents directory: %@", [fileMgr contentsOfDirectoryAtPath:documentsDirectory error:&error]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://stackoverflow.com/questions/5385480/iphone-downloding-zip-and-extracting-in-main-bundle-subdirectory-at-runtime | |
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"ZipFileName" ofType:@"zip"]; | |
ZipArchive *zipArchive = [[ZipArchive alloc] init]; | |
[zipArchive UnzipOpenFile:filepath Password:@"xxxxxx"]; | |
[zipArchive UnzipFileTo:{pathToDirectory} overWrite:YES]; | |
[zipArchive UnzipCloseFile]; | |
[zipArchive release]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From: http://stackoverflow.com/questions/4743317/iphone-how-to-copy-a-file-from-resources-to-documents | |
NSFileManager *fmngr = [[NSFileManager alloc] init]; | |
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"mydb.sqlite" ofType:nil]; | |
NSError *error; | |
if(![fmngr copyItemAtPath:filePath toPath:[NSString stringWithFormat:@"%@/Documents/mydb.sqlite", NSHomeDirectory()] error:&error]) { | |
// handle the error | |
NSLog(@"Error creating the database: %@", [error description]); | |
} | |
[fmngr release]; |
NewerOlder