1
バックアップのために現在の.sqliteファイルの場所を見つける必要があります。どうすればいいですか?これは、 "ファイルが見つかりません" を返し、私が持っているコードです:私はGoogleのを見て、SOきデバイス上の現在の.sqliteファイルを見つける方法(iPad)
-(NSString *)createCoreDataStorePath {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
NSString *applicationSupportDirectory = [paths firstObject];
NSString *coreDataStorePath = [applicationSupportDirectory stringByAppendingPathComponent:@"/books"];
NSLog(@"\n\ncoreDataStorePath: %@", coreDataStorePath);
return coreDataStorePath;
}
:ここ
// find current directory for saori.sqlite
NSString *coreDataStorePath = [self createCoreDataStorePath];
// sqlite store setup
NSString *storePath = [coreDataStorePath stringByAppendingPathComponent:@"BookstoreInventoryManager.sqlite"]; // Application Support/SalonBook/saori.sqlite/saori.sqlite
NSLog(@"\n\nBACKUP - storePath: %@",storePath);
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath: storePath])
[MagicalRecord cleanUp]; // set stack, etc to 'nil'
else {
NSLog(@"\n\n-->BookstoreInventoryManager files not found"); // log message "unable to find sqlite files
return;
}
はcreateCoreDataStorePathのコードです私の答えは見つからなかった。
'coreDataStorePath'とは何ですか?あなたはどうやってそれを保持していますか? 'NSApplicationSupportDirectory'では? – Larme