ios - 使用AWSContinuationBlock发送兼容的指针 block 类型

标签 ios objective-c amazon-web-services

尝试使用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);
    }
}];

最佳答案

该错误是由于您提供的块需要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;
}];

关于ios - 使用AWSContinuationBlock发送兼容的指针 block 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31739190/

相关文章:

objective-c - NSOutputStream,NSStreamEventHasSpaceAvailable事件过去后如何正确输出数据?

ios - KVO 和重构

amazon-web-services - 有没有办法使用 Athena JDBC 驱动程序获取查询 ID 和状态?

iOS 音频单元获取当前时间戳

ios - 从 url 下载图像并将其存储为文件

ios - 核心数据 : Inserting from array of dictionaries into SQLite database happens unsorted - set of Foreign Key therefore not possible

amazon-web-services - AWS ASG 冷却期和扩展策略中的预热期有什么区别?

ios - 有没有办法刷新 UIImage 类使用的缓存?

ios - 从 UITapGestureRecognizer 获取对象的标签

python - AWS ECS - 使用 Boto3 更新任务定义