AWS 分析 - swift 3 - iOS?

问答

我试图在 Swift 3 中使用移动分析,目前通过 CocoaPods 拥有 AWSCore 2.5.9 和 AWSMobileAnalytics 2.5.9,但我无法记录任何事件。我的合作伙伴使用与CognitoIdentityPoolId我使用的相同的 Android 成功记录了事件,我还确认它AmazonMobileAnalyticsFullAccess附加了策略。

我的 AppDelegate 中有以下代码 didFinishLaunchingWithOptions

  let credentialsProvider = AWSCognitoCredentialsProvider(regionType:.USWest2,
                  identityPoolId:"us-west-2:theRestOfMyID")

      let configuration = AWSServiceConfiguration(region:.USWest2,
                                                  credentialsProvider:credentialsProvider)

      AWSServiceManager.default().defaultServiceConfiguration = configuration

      let analyticsConf = AWSMobileAnalyticsConfiguration.init()

      analyticsConf.serviceConfiguration = AWSServiceManager.default().defaultServiceConfiguration

      _ = AWSMobileAnalytics.init(forAppId: "MyMobileAnalyticsAppId", configuration: analyticsConf)

这导致控制台输出:

2017-07-20 16:39:53:875 test2[7288:125553] Mobile Analytics SDK(2.0-alpha) Initialization successfully completed.
2017-07-20 16:39:53:875 test2[7288:125635] 
==========Batch Object==========
{"attributes":{"_session.id":"82e879d9-C9E6D9C7-20170720-233953870","ver":"v2.0","_session.startTime":"2017-07-20T23:39:53.872Z"},"event_type":"_session.start","timestamp":"2017-07-20T23:39:53.873Z"}
2017-07-20 16:39:53:876 test2[7288:125635] Event: '_sess...' recorded to local filestore

我有一个按钮,用于记录事件然后尝试提交事件:

 let eventClient = AWSMobileAnalytics(forAppId: "MyMobileAnalyticsAppId").eventClient

      guard let client = eventClient else {
         print("Error creating AMA event client")
         return
      }
      guard let event = client.createEvent(withEventType: "test_50_logIn") else {
         print("Error creating AMA event")
         return
      }
      event.addAttribute("username", forKey: "sample")
      event.addAttribute("device", forKey: "ios")
      client.record(event)

      client.submitEvents()

但是, submitEvents 总是触发以下错误,这两天我一直无法解决。因此,我一直无法记录单个 iOS 事件。

2017-07-20 16:46:01:736 test2[7566:129412] Unable to successfully deliver events to server. Error Message:Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={NSUnderlyingError=0x6080002438a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_kCFStreamErrorCodeKey=8, _kCFStreamErrorDomainKey=12}}, NSErrorFailingURLStringKey=https://mobileanalytics.us-west-2.amazonaws.com/2014-06-05/events, NSErrorFailingURLKey=https://mobileanalytics.us-west-2.amazonaws.com/2014-06-05/events, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSLocalizedDescription=A server with the specified hostname could not be found.}

我在集成指南下看不到其他步骤,如果 ID 在 android 集成中工作得很好,有人知道可能是什么问题吗?谢谢!

弥敦道

移动分析在美国西部 ( Docs ) 中不可用

问:Amazon Mobile Analytics 服务在哪些 AWS 区域可用?

目前,Amazon Mobile Analytics 在 AWS美国东部(弗吉尼亚北部)区域可用

您只需要更改您的区域AWSServiceConfiguration

let serviceConfiguration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialsProvider)
let analyticsConfiguration = AWSMobileAnalyticsConfiguration()
analyticsConfiguration.serviceConfiguration = serviceConfiguration
_ = AWSMobileAnalytics(forAppId: "MyMobileAnalyticsAppId", configuration: analyticsConfiguration)

端点:
https : //mobileanalytics.us-west-2.amazonaws.com => 不起作用
https://mobileanalytics.us-east-1.amazonaws.com/ => 是否

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

AWS iOS Swift 3 Cognito类型不符合协议

来自分类Dev

Swift / iOS:分析(lldb)崩溃,PayPal iOS SDK

来自分类Dev

在iOS上的Swift中使用Google Analytics(分析)

来自分类Dev

installing AWS ios sdk in swift project

来自分类Dev

在swift项目中安装AWS ios SDK

来自分类Dev

Swift 2或3中的Google Analytics(分析)问题

来自分类Dev

Swift 3:过滤 IOS 通知

来自分类Dev

iOS Swift 3 POST 问题

来自分类Dev

iOS Swift 3 发布问题

来自分类Dev

swift 3, iOS - UIImageView 背景

来自分类Dev

AWS 物联网分析

来自分类Dev

Firebase 分析 iOS

来自分类Dev

iOS 谷歌分析日落

来自分类Dev

Swift无法导入Sqlite3 iOS

来自分类Dev

注册推送通知Swift 3 + iOS 10

来自分类Dev

Swift 3 iOS兼容性

来自分类Dev

Swift 3 Color Space macOS不是IOS

来自分类Dev

swift 3 ios tableview 按单元滚动

来自分类Dev

iOS Swift 3 CompletionHandler 不起作用

来自分类Dev

Swift 3 - iOS 11.2 上的 UICollectionview 问题

来自分类Dev

iOS(Swift)应用中的AWS Cognito用户池

来自分类Dev

iOS(Swift)应用中的AWS Cognito用户池

来自分类Dev

如何同时使用 S3 和 EBS 在 AWS 上进行经济高效的分析?

来自分类Dev

用于点击流分析的 AWS S3 数据格式

来自分类Dev

AWS移动分析KIPs API

来自分类Dev

未声明iOS版Google Analytics(分析)v3的kGAIScreenName吗?

来自分类Dev

HTTP / 3:框架分析

来自分类Dev

问:将swift2转换为swift3之后的相关性分析错误

来自分类Dev

iOS AWS S3 Transfer Utility未上传