1

I have this in my class header:

typedef void(^DBSuccessBlock)();
typedef void(^DBErrorBlock)(int errorNumber, NSString* description);

- (void) connect:(NSString*) path isFile:(BOOL) flag
        success:(DBSuccessBlock) success
          error:(DBErrorBlock) error;

This is how I'm trying to call the method:

[db connect:filePathName isFile:YES success:^{
    // initialize db here if necessary
} error:^(int errorNumber, NSString *description) { //error on this line
    NSLog(description);
    return nil;
}];

The error line is giving me this compile error: Incompatible block pointer types sending 'void *(^)(int, NSString *_strong)' to parameter of type 'DBErrorBlock' (aka 'void (^)(int, NSString *_strong)')

The only difference I see is void* vs void and I'm not sure why. Can anyone help me figure out why I'm getting this error? Thanks.

Aaron Bratcher
  • 6,051
  • 2
  • 39
  • 70

1 Answers1

1

You are returning the value nil in a block with return type void. Remove the return nil line.

Rob Bajorek
  • 6,382
  • 7
  • 44
  • 51