简体   繁体   English

使用Amazon SDK和存储桶策略将图像从ios应用程序上传到Amazon S3

[英]Uploading images to amazon s3 from ios app using amazon sdk and bucket policy

I am having trouble uploading images from my ios app to amazon s3 using their newest sdk. 我无法使用最新的SDK将图像从ios应用程序上传到Amazon s3。 How can I upload images without using their cognito service? 如何在不使用图片识别服务的情况下上传图片? For example, I have an api in my website that returns the following information 例如,我的网站上有一个api,它返回以下信息

{
"success": true,
"data": {
    "policy":   "some policy",
    "signature": "a signature",
    "key": "a key"
    }
}

Now my question is, even without setting up those Cognito credentials that is in the sample app of amazon sdk, how do i use the above information to upload to the bucket (assuming I know the bucket name)? 现在我的问题是,即使没有设置亚马逊sdk示例应用程序中的那些Cognito凭据,我如何使用以上信息将其上传到存储桶(假设我知道存储桶名称)?

Thank you 谢谢

1 down vote 1次否决

I suggest that never use AWS in Moblie Application without Cognito. 我建议不要在没有Cognito的情况下在Moblie Application中使用AWS。

If you still want to do that you can create an IAM user set policy to your bucket resources and put theIAM user credential to your code 如果仍要这样做,则可以为存储桶资源创建IAM用户集策略,并将IAM用户凭据放入代码中

AWSStaticCredentialsProvider *credentialsProvider = [AWSStaticCredentialsProvider credentialsWithAccessKey:@"YourAccessKey" secretKey:@"YourSecretKey"];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM