백업 루틴의 일부로 일부 파일을 복사하려고합니다.Obj-C, NSSearchPathForDirectoriesInDomains를 사용하여 파일을 복사하려면 어떻게해야합니까?
나는 나의 파일의 위치를 알려주는 다음과 같은 기능을 가지고있다.
- (NSString *)getLocalDocumentPath:(NSString*)strFile {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *path = [[paths objectAtIndex:0]
stringByAppendingPathComponent:strFile];
return path;
}
Heres는 내 데이터베이스
NSString *filePath = [self getLocalDocumentPath:@"mydatabase.db"];
나는 파일을 다운로드 나중에 그런
NSString *filePath = [self getLocalDocumentPath:@"upload.txt"];
upload.txt라는 새로운 파일이 복사 할.
NSString *filePath = [self getLocalDocumentPath:@"download.txt"];
원본 데이터베이스 파일 위에 복사 할 파일. 당신이 (문서는 당신을 위해 링크) 잘 NSFileManager을 알고 싶어처럼
NSString *filePath = [self getLocalDocumentPath:@"mydatabase.db"];