将'__autoreleasing .....'发送到不兼容类型的参数

0xS*_*ina 1 cocoa-touch objective-c ios automatic-ref-counting

我有个街区;

typedef void (^SIResponseHandler) (id obj, NSString *error);
Run Code Online (Sandbox Code Playgroud)

和方法:

+ (void)uploadPhoto:(UIImage *)photo
toPathForComponents:(NSArray *)components
  completionHandler:(SIResponseHandler)responseHandler;
Run Code Online (Sandbox Code Playgroud)

和另一种调用上述方法的方法:

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

    NSArray *components = @[@"users", sharedInstance.username, @"profile", @"photo", @"upload"];
    [SIRequest uploadPhoto:photo
       toPathForComponents:components
           progressHandler:nil
         completionHandler:handler];
}
Run Code Online (Sandbox Code Playgroud)

在最后一行,我收到此错误:

Sending '__autoreleasing SIResponseHandler *' (aka 'void (^__autoreleasing *)(__strong id, NSString *__strong)') to parameter of incompatible type 'SIResponseHandler' (aka 'void (^)(__strong id, NSString *__strong)')
Run Code Online (Sandbox Code Playgroud)

我不知道这是什么意思.有人可以解释一下发生了什么吗?谢谢

Ric*_*III 5

它似乎SIResponseHandler是一个块类型,因此不应该*在参数列表中作为指针加后缀,除非你确切知道你在做什么.