2014-11-05 2 views
-1

나는 MAgicalRecords와 OSX로 프로젝트를 가지고 있으며, 그것은 변환기 SQLIT -> coreData이다. 요세미티 전에 - 그것은 잘 작동하지만 업데이트 후 -이 어떤 문제파일 복사 10.10 Yosemite

내 내가

if ([fileManager fileExistsAtPath:from]) { 

    NSFileHandle *fileHandle = [NSFileHandle fileHandleForUpdatingAtPath:from]; 
    [fileHandle seekToEndOfFile]; 
    [fileHandle closeFile]; 

    [fileManager copyItemAtPath:from toPath:to error:NULL]; 
} 

를 변환 한 후 얻을 데이터베이스를 복사하려고하지만,이 갖고 파일을 여기에보다 단계

[MagicalRecord saveWithBlockAndWait:^(NSManagedObjectContext *localContext) { 
         //do some workd with save entity }]; 

테이블과 칼럼을 복사하기 전에 그의 크기는 165kb입니다. 그리고 대처 한 후에 - 그는 비어 있습니다. MAC의 새로운 기능입니까? 여러분도 알다시피 나는 [fileHandle closeFile]; 하지만 여전히 작동하지 않습니다.

copyng 파일 "from"앞에 프로젝트를 닫으면 1.8MB가 있고 모든 데이터가 있습니다.

3 개 파일

Main.sqlite 
Main.sqlite-shm 
Main.sqlite-wal 

그것은 "일부 메모리"에 OS 흰색 데이터처럼 보이지만 직접적으로 파일이 있습니다. 나는 해결책을 찾으려고하지만 아무 것도 찾지 못했습니다. 도와주세요

답변

0

감사는 SQL 저널 모드 문제였다

+ (NSDictionary *) getOptionsForCreate { 
NSDictionary *pragmaOptions = [NSDictionary dictionaryWithObject:@"MEMORY" forKey:@"journal_mode"]; 

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: 
         [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, 
         [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, 
         pragmaOptions, NSSQLitePragmasOption, nil]; 
return options; 

}

NSPersistentStore *store = [self addPersistentStoreWithType:NSSQLiteStoreType 
               configuration:nil 
                 URL:url 
                options:[sel getOptionsForCreate] 
                 error:&error]; 
관련 문제