0

我是使用AWS作为iOS移动应用程序的后端的新手。我已经建立了所有需要的角色和身份。我有下面的代码添加到我的AppDelegate.m文件:检查Amazon Cognito角色(Auth vs Unauth)

// Starting AWS 
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@"IdentityPool"]; 

AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1 credentialsProvider:credentialsProvider]; 

什么是下一个步骤,看看我验证过了?试图figue了iOS的代码,看看我在什么样的角色。

要使用AWS,然后
AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration; 

回答

0

进口服务头只是尝试对AWS服务的调用。

AWSS3Transfermanager *transferManager = [AWSS3Transfermanager defaultS3TransferManager]; 
AWSS3TransferManagerUploadRequest *uploadRequest = [AWSS3TransferManagerUploadRequest new]; 
uploadRequest.bucket = yourBucket; 
uploadRequest.key = yourKey; 
uploadRequest.body = yourDataURL; 
uploadRequest.contentLength = [NSNumber numberWithUnsignedLongLong:fileSize]; 

[[transferManager upload:uploadRequest] continueWithBlock:^id(AWSTask *task) { 
    // Do something with the response 
    return nil; 
}];