2013-03-02 22 views
1

我有一個塊;發送'__autoreleasing .....'到不兼容類型的參數

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

和方法:

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

並調用上面的方法,另一種方法:

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

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

在最後一行中,我得到這個錯誤:

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

我不知道這是什麼意思。有人可以解釋發生了什麼事嗎? 謝謝

回答

5

看起來,SIResponseHandler是一個塊類型,因此不應該在參數列表中作爲指針與*後綴,除非你確切地知道你在做什麼。

+0

ahhh,哇,那是一個錯誤/錯字。感謝您指出了這一點! – 0xSina 2013-03-02 19:22:19

相關問題