【问题标题】:IOS Swift Amazon S3 transfer utility- nil is not compatible with expected argument type nsurlIOS Swift Amazon S3 传输实用程序 - nil 与预期的参数类型 nsurl 不兼容
【发布时间】:2016-04-01 13:59:36
【问题描述】:

我是 Amazon S3 的新手,正在尝试在 GitHub https://github.com/awslabs/aws-sdk-ios-samples/tree/master/S3BackgroundTransfer-Sample/Swift 中找到的示例 但是当我尝试构建和运行时,我收到以下错误消息

nil 与预期的参数类型 nsurl 不兼容

下面是我遇到问题的代码。

let transferUtility = AWSS3TransferUtility.defaultS3TransferUtility()

    transferUtility.downloadToURL(nil, bucket: S3BucketName, key: S3DownloadKeyName, expression: expression, completionHander: completionHandler).continueWithBlock { (task) -> AnyObject! in
        if let error = task.error {
            NSLog("Error: %@",error.localizedDescription);
            self.statusLabel.text = "Failed"
        }
        if let exception = task.exception {
            NSLog("Exception: %@",exception.description);
            self.statusLabel.text = "Failed"
        }
        if let _ = task.result {
            self.statusLabel.text = "Starting Download"
            NSLog("Download Starting!")
            // Do something with uploadTask.
        }
        return nil;
    }

请告诉我如何解决这个问题 谢谢

【问题讨论】:

    标签: ios swift amazon-s3


    【解决方案1】:

    不是我使用过AWSS3TransferUtility(还),但看起来您需要传递一个NSURL 实例,该实例指向您希望将文件下载到的位置。有一个how to do this (in obj-c) on the AWS developer blog的例子。

    【讨论】:

    • 不客气!如果答案解决了您的问题,请考虑将其标记为已接受(左侧的复选标记)。
    猜你喜欢
    • 1970-01-01
    • 2023-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多