0xSina
0xSina

Reputation: 21563

Sending '__autoreleasing .....'to parameter of incompatible type

I have a block;

typedef void (^SIResponseHandler) (id obj, NSString *error);

and a method:

+ (void)uploadPhoto:(UIImage *)photo
toPathForComponents:(NSArray *)components
  completionHandler:(SIResponseHandler)responseHandler;

and another method which calls the above method:

+ (void)updateProfilePhoto:(UIImage *)photo handler:(SIResponseHandler *)handler {

    NSArray *components = @[@"users", sharedInstance.username, @"profile", @"photo", @"upload"];
    [SIRequest uploadPhoto:photo
       toPathForComponents:components
           progressHandler:nil
         completionHandler:handler];
}

In the last line, I get this error:

Sending '__autoreleasing SIResponseHandler *' (aka 'void (^__autoreleasing *)(__strong id, NSString *__strong)') to parameter of incompatible type 'SIResponseHandler' (aka 'void (^)(__strong id, NSString *__strong)')

I have no idea what this means. Can someone please explain what's going on ? Thanks

Upvotes: 1

Views: 1840

Answers (1)

Richard J. Ross III
Richard J. Ross III

Reputation: 55573

It appears that SIResponseHandler is a block type, and as such should not be suffixed as a pointer with * in an argument list, unless you know exactly what you are doing.

Upvotes: 5

Related Questions