mryozo16/ziparchive

Assigning a ZipArchiveDelegate to grab the error messages does not work

Opened this issue · 1 comments

What steps will reproduce the problem?
1. Create and assigning a ZipArchiveDelegate to grab the error messages:


@interface MyZipArchiveDelegate:NSObject <ZipArchiveDelegate>
@end


@implementation MyZipArchiveDelegate
- (void) ErrorMessage:(NSString *) msg {
    NSLog(@"%@",msg);
};
@end


.....

then use it:


    self.zip = [[ZipArchive alloc] init];
    MyZipArchiveDelegate * zipdelegate=[[MyZipArchiveDelegate alloc]init];
    self.zip.delegate =zipdelegate;


.....

now the if statement in ZipArchive.mm 

 [ self.zip.delegate respondsToSelector:@selector(ErrorMessage)] returns NO, but should return YES.

the condition has an error in it (it lacks the :)

using the ErrorMessage: 
 [ self.zip.delegate respondsToSelector:@selector(ErrorMessage:)] 

returns YES.

The same counts for the OverWrite

The fixed methods in ZipArchive.mm (line 200-212) look like this:

#pragma mark wrapper for delegate
-(void) OutputErrorMessage:(NSString*) msg
{
    if( _delegate && [_delegate respondsToSelector:@selector(ErrorMessage:)] )
        [_delegate ErrorMessage:msg];
}

-(BOOL) OverWrite:(NSString*) file
{
    if( _delegate && [_delegate respondsToSelector:@selector(OverWriteOperation:)] )
        return [_delegate OverWriteOperation:file];
    return YES;
}

Original issue reported on code.google.com by voormar...@gmail.com on 15 Oct 2012 at 11:27

Agreed. The missing colon was the problem. I encountered same issue.

Original comment by robert.r...@mindspring.com on 21 Oct 2013 at 8:03