在执行任何和UOS服务相关请求前都需要先生成一个Client对象。
初始化客户端的方法如下。
// 1.初始化用户身份信息 String accessKey = "AKXXXXXX"; String secretKey = "SKXXXXXX"; // 2. 生成client let credentialsProvider = AWSStaticCredentialsProvider(accessKey: accessKey, secretKey: secretKey) let endPoint = AWSEndpoint(region:AWSRegionType.EUWest1, service:AWSServiceType.S3, url: url) let configuration = AWSServiceConfiguration(region: .EUWest1, endpoint: endPoint,credentialsProvider: credentialsProvider) AWSServiceManager.default().defaultServiceConfiguration = configuration AWSS3.register(with: AWSServiceConfiguration(region: .EUWest1, endpoint: endPoint,credentialsProvider: credentialsProvider), forKey: "EUWestS3") let s3 = AWSS3.default() |