我试图按照在“上载对象”列出的步骤操作: http://docs.aws.amazon.com/mobile/sdkforios/developerguide/s3transfermanager.html
不过,我在转换的东西斯威夫特因为那是什么,我已经想出下面的代码我的整个应用程序编写,但是当我运行它没有被上传到我指定了水桶。 不幸的是我甚至不得到一个错误,这使得它很难解决 - 你可以看到下面,我试图打印任何错误到控制台,但myBFTask.error最终被空。 同时myBFTask.result也为空。 对于背景下,这个代码是所有里面的imagePickerController didFinishPickingMediaWithInfo。 到哪里寻找未来任何提示将不胜感激。
var pickedURL:NSURL = info[UIImagePickerControllerMediaURL] as NSURL
println("here's the url for the picked media: \(pickedURL)")
//make a timestamp variable to use in the key of the video I'm about to upload
let date:NSDate = NSDate()
var unixTimeStamp:NSTimeInterval = date.timeIntervalSince1970
var unixTimeStampString:String = String(format:"%f", unixTimeStamp)
println("this is my unix timestamp as a string: \(unixTimeStampString)")
var myTransferManagerRequest:AWSS3TransferManagerUploadRequest = AWSS3TransferManagerUploadRequest()
myTransferManagerRequest.bucket = "kikfli1.videolist"
myTransferManagerRequest.key = "\(self.fbid)_\(unixTimeStampString)"
myTransferManagerRequest.body = pickedURL
var myBFTask:BFTask = BFTask()
var myMainThreadBFExecutor:BFExecutor = BFExecutor.mainThreadExecutor()
var myTransferManager:AWSS3TransferManager = AWSS3TransferManager()
myTransferManager.upload(myTransferManagerRequest).continueWithExecutor(myMainThreadBFExecutor, withBlock: { (myBFTask) -> AnyObject! in
println("I'm inside the completion block")
if((myBFTask.result) != nil){
println("upload was successful?")
}else{
println("upload didn't seem to go through..")
var myError = myBFTask.error
println("error: \(myError)")
}
return nil
})
这里是被印到我的控制台:
用户选择了一个视频,提交!
这里的采摘媒体的网址:文件:xxxxxxxxxxxxxxx.MOV(显然是一个实际的文件路径)
这是我的UNIX时间戳为一个字符串:1417506382.414219
我完成块内
上传似乎没有经历..
误差为零