不使用 Cognito 的 Amazon Mobile Analytics
Amazon Mobile Analytics without using Cognito
我想使用 Amazon Mobile Analytics iOS,而不使用 Cognito 身份池进行身份验证。我知道
我只能说 Mobile Analytics FAQ 状态的统计数据:
Q: Do I need to use Amazon Cognito to use the Amazon Mobile Analytics service?
No. You can initialize Amazon Mobile Analytics using AWS IAM accounts. However, we recommend using Amazon Cognito for security best practices. Detailed documentation for both methods can be found here.
但是,绝对没有详细文档介绍如何对 IAM 用户使用 Mobile Analytics。我已经设置了一个 IAM 用户并给它 the appropriate permissions 写入移动分析。我只是不知道如何在 iOS AWS 移动框架中使用此用户。
有人可以帮我解决这个问题吗?还是引用的常见问题解答已经过时了?
我在 this post from the AWS developer forum 中找到了解决方案。
这是使用 IAM 用户而不是 Cognito 为 iOS 初始化 AWS Mobile Analytics 所需的完整代码:
AWSStaticCredentialsProvider *credentialsProvider =
[[AWSStaticCredentialsProvider alloc]
initWithAccessKey:@"IAM_USER_ID"
secretKey:@"IAM_USER_SECRET"];
AWSServiceConfiguration *serviceConf =
[[AWSServiceConfiguration alloc]
initWithRegion:AWSRegionUSEast1
credentialsProvider:credentialsProvider];
AWSMobileAnalyticsConfiguration *analyticsConf = [AWSMobileAnalyticsConfiguration new];
analyticsConfig.serviceConfiguration = serviceConf;
AWSMobileAnalytics *analytics = [AWSMobileAnalytics
mobileAnalyticsForAppId:@"MOBILE_ANALYTICS_APP_ID"
configuration: analyticsConfig
completionBlock:^(AWSMobileAnalytics *mobileAnalytics) {}];
我想使用 Amazon Mobile Analytics iOS,而不使用 Cognito 身份池进行身份验证。我知道
Q: Do I need to use Amazon Cognito to use the Amazon Mobile Analytics service?
No. You can initialize Amazon Mobile Analytics using AWS IAM accounts. However, we recommend using Amazon Cognito for security best practices. Detailed documentation for both methods can be found here.
但是,绝对没有详细文档介绍如何对 IAM 用户使用 Mobile Analytics。我已经设置了一个 IAM 用户并给它 the appropriate permissions 写入移动分析。我只是不知道如何在 iOS AWS 移动框架中使用此用户。
有人可以帮我解决这个问题吗?还是引用的常见问题解答已经过时了?
我在 this post from the AWS developer forum 中找到了解决方案。
这是使用 IAM 用户而不是 Cognito 为 iOS 初始化 AWS Mobile Analytics 所需的完整代码:
AWSStaticCredentialsProvider *credentialsProvider =
[[AWSStaticCredentialsProvider alloc]
initWithAccessKey:@"IAM_USER_ID"
secretKey:@"IAM_USER_SECRET"];
AWSServiceConfiguration *serviceConf =
[[AWSServiceConfiguration alloc]
initWithRegion:AWSRegionUSEast1
credentialsProvider:credentialsProvider];
AWSMobileAnalyticsConfiguration *analyticsConf = [AWSMobileAnalyticsConfiguration new];
analyticsConfig.serviceConfiguration = serviceConf;
AWSMobileAnalytics *analytics = [AWSMobileAnalytics
mobileAnalyticsForAppId:@"MOBILE_ANALYTICS_APP_ID"
configuration: analyticsConfig
completionBlock:^(AWSMobileAnalytics *mobileAnalytics) {}];