0
내 앱에서 압축을 풀고 Zip 파일의 콘텐츠를 처리하고 싶습니다.NSKeyedArchiver를 사용하여 iOS에서 보관
-(void) unarchive{
NSString *outputDirectory = [[NSHomeDirectory() stringByAppendingString:@"/Documents/"] stringByAppendingString:@"TheNewFolderName/"];
NSLog(@"Output Directory: %@", outputDirectory);
//MyArchive.zip is the filename of the zip file I placed in Xcode
NSData *theArchive = [NSKeyedUnarchiver unarchiveObjectWithFile:@"MyArchive.zip"];
NSError *error;
[theArchive writeToFile:outputDirectory options:NSDataWritingAtomic error:&error];
NSLog(@"theArchive is %@", theArchive);
그리고이 인쇄 "theArchive가 null"
내가 외부 라이브러리를 사용하지 않고,이 코코아 방법으로 할 노력하고있어, 그래서 내가 여기 NSKeyedUnarchiver
에 의존하고 있어요 내 코드입니다! 내가 도대체 뭘 잘못하고있는 겁니까..?
실은 ...이 작품은 나를 위해 : http://stackoverflow.com/questions/5385480/iphone-downloding-zip-and-extracting-in-main-bundle-subdirectory-at-runtime 하지만 ... 따라서 런타임에 zip 파일의 압축을 푸는 유일한 방법은 타사 라이브러리를 사용하는 것입니다. – Eric