@"ZZOpenOptionsCreateIfMissingKey" - code: 0, archive succeeds
Closed this issue · 1 comments
richardtop commented
I'm archiving a set of files with the following code:
NSString * zipPath = [NSString stringWithFormat:@"%@/%@", [Utility getSpeificDirectroyPath:DOCDIR], zipFileName];
[[NSFileManager defaultManager] removeItemAtPath:zipPath error:nil];
ZZArchive* newArchive = [[ZZArchive alloc] initWithURL:[NSURL fileURLWithPath: zipPath]
options:@{ZZOpenOptionsCreateIfMissingKey : @YES}
error:nil];
NSMutableArray *entries = [NSMutableArray new];
for (NSString *path in pathArray) {
NSString *filename = [path lastPathComponent];
ZZArchiveEntry *entry = [ZZArchiveEntry archiveEntryWithFileName: filename compress:NO dataBlock:^NSData * _Nullable(NSError * _Nullable * _Nullable error) {
return [[NSFileManager defaultManager] contentsAtPath:path];
}];
[entries addObject:entry];
}
NSError *error;
[newArchive updateEntries:[entries copy]
error:&error];
BOOL success = (error == nil);
The archive is successful, however, in the end the error
variable is not nil, but rather contains vague description:
(lldb) po error
domain: @"ZZOpenOptionsCreateIfMissingKey" - code: 0
What does this error mean?
richardtop commented
Linking my target against ImageIO.framework
solved the problem.