从 [=s10=] 2.2 升级到 Swift 3.0 后,对 `continue` 的使用不明确

Ambigous use of `continue` after upgrading from Swift 2.2 to Swift 3.0

我有一个 swift 项目,我正在那里使用 Amazon Web Services。

我有一个功能负责将图像上传到我的 S3 存储桶,在 Swift 2.2 中它运行良好,代码如下:

let credentialsProvider = AWSCognitoCredentialsProvider(regionType:CognitoRegionType,
                                                            identityPoolId:CognitoIdentityPoolId)
    let configuration = AWSServiceConfiguration(region:CognitoRegionType, credentialsProvider:credentialsProvider)
    AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration



let uploadRequest = AWSS3TransferManagerUploadRequest()
uploadRequest.body = NSURL(string: "file://"+pathToFile)
uploadRequest.key = NSProcessInfo.processInfo().globallyUniqueString + "." + ext
uploadRequest.bucket = S3BucketName
uploadRequest.contentType = contentType + ext

let transferManager = AWSS3TransferManager.defaultS3TransferManager()
    transferManager.upload(uploadRequest).continueWithBlock { (task) -> AnyObject! in

        if (task.completed) {
        ...

现在,升级到 Swift 3 后,我有:

let credentialsProvider = AWSCognitoCredentialsProvider(regionType:CognitoRegionType,
                                                            identityPoolId:CognitoIdentityPoolId)
    let configuration = AWSServiceConfiguration(region:CognitoRegionType, credentialsProvider:credentialsProvider)
    AWSServiceManager.default().defaultServiceConfiguration = configuration



let uploadRequest = AWSS3TransferManagerUploadRequest()
uploadRequest?.body = URL(string: "file://"+pathToFile)
uploadRequest?.key = ProcessInfo.processInfo.globallyUniqueString + "." + ext
uploadRequest?.bucket = S3BucketName
uploadRequest?.contentType = contentType + ext

let transferManager = AWSS3TransferManager.default()
    transferManager?.upload(uploadRequest).continueWithBlock { (task) -> AnyObject! in

        if (task.isCompleted) {

现在在最后一条语句中 transferManager?.upload(uploadRequest).continueWithBlock 抛出一个错误

'continueWithBlock' has been renamed to 'continue(_:)'

所以我听从他们的建议并将其更改为:

transferManager?.upload(uploadRequest).continue { 

但随后它抛出一个错误:

Ambigous use of continue

可用的方法在这里:

但我不确定在这种情况下我可以使用哪一个。你能帮我吗?

好的,我找到了问题,它比我想象的要容易...这里提到了:https://github.com/aws/aws-sdk-ios/issues/473 并说要更改

transferManager?.upload(uploadRequest).continue { ... }

transferManager?.upload(uploadRequest).continue ({ ... })

这种情况下的方法命名确实很烦人,但它确实有效。