#ios #swift #amazon-web-services #amazon-s3
#iOS #swift #amazon-веб-сервисы #amazon-s3
Вопрос:
Использование файла cocoapod AWS для загрузки
модуль ‘AWSS3’, модуль ‘AWSCognito’, модуль ‘AWSCore’
создание конфигурации с использованием accesskey и secretkey
let credentialsProvider = AWSStaticCredentialsProvider(accessKey: accessKey, secretKey: secretKey)
let configuration = AWSServiceConfiguration(region:.USEast1, credentialsProvider:credentialsProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
Попытка загрузить изображение с помощью transferutility
transferUtility!.uploadData(imageData! as Data,
bucket: S3BucketName,
key: fileName,
contentType: "image/*",
expression: expression,
completionHandler: completionHandler).continueWith {
(task) -> AnyObject? in
if let error = task.error {
print("Error: (error.localizedDescription)")
}
if let result = task.result {
print ("upload successful.")
print (result.response)
}
return nil;
}
Получение ошибки при обработке завершения с
Домен =com.amazonaws.AWSS3 Transferutilityerrordomain Code= 2 «(null)» userInfo={Сервер = AmazonS3, Передача-кодировка = идентификатор, Соединение = закрытие, тип содержимого = application / xm}