gpt4 book ai didi

ios - 在 Swift 中集成 Amazon Simple Email Services API 时出现问题

转载 作者:行者123 更新时间:2023-11-30 13:46:18 26 4
gpt4 key购买 nike

我想使用 Objective-C 中定义的“verifyEmailIdentity”操作作为 Amazon Simple Email Service API 的一部分,但我在 Swift 中遇到了麻烦。我想在 Swift 代码中调用该操作,并在 pod 中定义该操作的文档,但我不太确定如何执行此操作。

这是一些示例代码,但我的程序无法识别返回类型。

func createRequest(verifyEmailIdentityRequest: SESVerifyEmailIdentityRequest) -> AmazonServiceRequest {
var request: AmazonServiceRequest = SESRequest()
request.setParameterValue("VerifyEmailIdentity", forKey: "Action")
request.setParameterValue("2010-12-01", forKey: "Version")
request.delegate = verifyEmailIdentityRequest.delegate
request.credentials = verifyEmailIdentityRequest.credentials()
request.endpoint = verifyEmailIdentityRequest.requestEndpoint()
request.requestTag = verifyEmailIdentityRequest.requestTag()
if verifyEmailIdentityRequest != nil {
if verifyEmailIdentityRequest.emailAddress != nil {
request.setParameterValue("\ (verifyEmailIdentityRequest.emailAddress)", forKey: "\("EmailAddress")")
}
}
return request
}

http://docs.aws.amazon.com/ses/latest/APIReference/API_VerifyEmailIdentity.html

最佳答案

您可以通过使用以下代码片段来实现这一点:

func verifyEmailIdentity(verifyEmailIdentityRequest: AWSSESVerifyEmailIdentityRequest) {

// You should ideally set your configuration in app delegate
// Set the region and cognito pool id
let credentialsProvider = AWSCognitoCredentialsProvider(
regionType: AWSRegionType.Unknown,
identityPoolId: "YOUR_POOL_ID")
let configuration = AWSServiceConfiguration(
region: AWSRegionType.Unknown,
credentialsProvider: credentialsProvider)
AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration

let ses = AWSSES.defaultSES()
ses.verifyEmailIdentity(verifyEmailIdentityRequest).continueWithBlock { (task: AWSTask) -> AnyObject? in
if let error = task.error {
// handle error here
} else if let result = task.result {
// handle result here
}
return nil
}
}

谢谢,罗汉

关于ios - 在 Swift 中集成 Amazon Simple Email Services API 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34887949/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com