iOS Swift:将AWS开发工具包与xCode6配合使用-错误消息 [英] iOS Swift: Using AWS SDK with xCode6 - error message

查看:73
本文介绍了iOS Swift:将AWS开发工具包与xCode6配合使用-错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用CocoaPods已将AWS库添加到我的项目中.

Using CocoaPods have added the AWS libraries to my project.

创建了BridgingHeader.h文件:

Created a BridgingHeader.h file:

#import "AWSCore.h"
#import "AWSCognito.h"
#import "AWSS3.h"

在应用程序的构建设置">"Objective-C桥接标题"中包含此BridgingHeader.h文件.

In application Build Settings > Objective-C Bridging Headers included this BridgingHeader.h file.

当我使用凭据初始化代码时,现在在我的代码中:

Now in my code when i use the credentials initialisation code:

let credentialsProvider = AWSCognitoCredentialsProvider.credentialsWithRegionType(
    AWSRegionType.USEast1,
    accountId: "999999999999",
    identityPoolId: "us-east-1:ac328da6-63f3-4748-9b8f-999999999",
    unauthRoleArn: "arn:aws:iam::69644888888:role/Cognito_s3tutorialUnauth_DefaultRole",
    authRoleArn: "arn:aws:iam::69647777777:role/Cognito_s3tutorialAuth_DefaultRole")

在编译时,我看到的错误是:

On compilation the error i see is:

credentialsWithRegionType不可用,请使用initWithRegionType ... 代替

credentialsWithRegionType is not available, Use initWithRegionType... instead

我也无法使用initWithRegionType ...,因为错误是: AWSCognitoCredentialsProvider没有名为initWithRegionType的成员

I am unable to use initWithRegionType too...because then the error is: AWSCognitoCredentialsProvider does not have a member named initWithRegionType

令人惊讶的是,我什至可以在我的IDE的右窗格中看到此签名和帮助:AWSCognitoCredentialsProvider.credentialsWithRegionType

Surprisingly i can even see the signature and help of this on the right pane of my IDE: AWSCognitoCredentialsProvider.credentialsWithRegionType

我想念什么?这可能是版本混淆吗?

What am i missing? Could this be a version mixup?

推荐答案

您可能必须将此函数用作Swift的构造函数:

You might have to use this function as constructor for Swift:

let CognitoRegionType = AWSRegionType.Unknown  // e.g. AWSRegionType.USEast1
let DefaultServiceRegionType = AWSRegionType.Unknown // e.g. AWSRegionType.USEast1
let CognitoIdentityPoolId = "YourCognitoIdentityPoolId"
let S3BucketName = "YourS3BucketName"
let credentialsProvider = AWSCognitoCredentialsProvider(regionType: CognitoRegionType, identityPoolId: CognitoIdentityPoolId)
let configuration = AWSServiceConfiguration(region: DefaultServiceRegionType, credentialsProvider: credentialsProvider)
AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration

这篇关于iOS Swift:将AWS开发工具包与xCode6配合使用-错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆