Objective-Zipに問題があります。私のzipを検証するときに例外をスローします。ファイルをチェックしましたが、解凍/zipに問題はありません。さらに、システムのデフォルトのアーカイバなどを使用してファイルを圧縮してみます。
私が使うZipFile *unzipFile= [[ZipFile alloc] initWithFileName:@"textPack.zip" mode:ZipFileModeUnzip];
メソッドを検証する
- (id) initWithFileName:(NSString *)fileName mode:(ZipFileMode)mode {
if (self= [super init]) {
_fileName= [fileName retain];
_mode= mode;
switch (mode) {
case ZipFileModeUnzip:
_unzFile= unzOpen([_fileName cStringUsingEncoding:NSUTF8StringEncoding]);
if (_unzFile == NULL) {
NSString *reason= [NSString stringWithFormat:@"Can't open '%@'", _fileName];
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
}
break;
case ZipFileModeCreate:
_zipFile= zipOpen([_fileName cStringUsingEncoding:NSUTF8StringEncoding], APPEND_STATUS_CREATE);
if (_zipFile == NULL) {
NSString *reason= [NSString stringWithFormat:@"Can't open '%@'", _fileName];
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
}
break;
case ZipFileModeAppend:
_zipFile= zipOpen([_fileName cStringUsingEncoding:NSUTF8StringEncoding], APPEND_STATUS_ADDINZIP);
if (_zipFile == NULL) {
NSString *reason= [NSString stringWithFormat:@"Can't open '%@'", _fileName];
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
}
break;
default: {
NSString *reason= [NSString stringWithFormat:@"Unknown mode %d", _mode];
@throw [[[ZipException alloc] initWithReason:reason] autorelease];
}
}
}
return self;
}
何かアドバイス?