2013-01-20 3 views
0

내가 보관하려고하는 문서가 문서 디렉토리에 복사됩니다. 그것은 시뮬레이터에서 정상적으로 작동하지만 장치의 오류로 중단됩니다.NSFileWrapper 오류 URL에 쓰기

- (BOOL)importData:(NSData *)zippedData { 

// Read data into a dir Wrapper 

NSData *unzippedData = [zippedData gzipInflate]; 

NSFileWrapper *dirWrapper = [[[NSFileWrapper alloc] initWithSerializedRepresentation:unzippedData] autorelease]; 

if (dirWrapper == nil) { 

    NSLog(@"Error creating dir wrapper from unzipped data"); 

    return FALSE; 

} 

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 

NSString *documentsDirectory = [paths objectAtIndex:0]; 

NSURL *dirUrl = [NSURL fileURLWithPath:documentsDirectory]; 

NSError *error; 

BOOL success = [dirWrapper writeToURL:dirUrl options:NSFileWrapperWritingAtomic originalContentsURL:nil error:&error]; 

if (!success) { 

    NSLog(@"Error importing file: %@", error.localizedDescription); 

    return FALSE; 

} 

// Success! 

return TRUE;  

} 

나는 콘솔에서 다음과 같은 출력 얻을 : 따라서 바로 전에 dirurl에 "문서"를 추가,

 
2013-01-19 22:40:23.865 My App[569:907] Foundation called mkdir("/var/mobile/Applications/1BF53E96-6261-4DEC-8700-60307D84587F/(A Document Being Saved By My App)"), it didn't return 0, and errno was set to 1. 

2013-01-19 22:40:23.922 My App[569:907] Error importing file: The operation couldn’t be completed. (Cocoa error 513.) 

답변

0

당신은 전화기의 문서 디렉토리에 쓸 수 있다고 생각을 당신의 (존재하는 문서 ...)