尝试使用AWSS3TransferManager运行块时出现以下错误:
incompatible block pointer types sending 'id ((^)(void)) to parameter of type 'AWSContinuationBlock' (aka id (^)(AWSTask *__strong))
我相信这是由于不同的块类型,我目前没有返回任何值,而它期望AWSTask,但我不知道如何返回AWSTask。
_uploadRequest = [AWSS3TransferManagerUploadRequest new];
AWSS3TransferManager *transferManager = [AWSS3TransferManager defaultS3TransferManager];
[[transferManager upload:_uploadRequest] continueWithExecutor:[BFExecutor mainThreadExecutor] withBlock:^id(BFTask *task){
if (task.error){
NSLog(@"%@",task.error);
}
}];
答案 0 :(得分:3)
错误是由于您提供的阻止BFTask
参数的阻止。
将BFTask
参数更改为AWSTask
并返回该参数。
_uploadRequest = [AWSS3TransferManagerUploadRequest new];
AWSS3TransferManager *transferManager = [AWSS3TransferManager defaultS3TransferManager];
[[transferManager upload:_uploadRequest] continueWithExecutor:[BFExecutor mainThreadExecutor] withBlock:^id(AWSTask *task){
if (task.error){
NSLog(@"%@",task.error);
}
return task;
}];